Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Merge requests
!81
Resolve "update of appointment clears data from daily planning"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "update of appointment clears data from daily planning"
166-update-of-appointment-clears-data-from-daily-planning
into
master
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Valentin Groues
requested to merge
166-update-of-appointment-clears-data-from-daily-planning
into
master
7 years ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#166 (closed)
Edited
7 years ago
by
Valentin Groues
0
0
Merge request reports
Viewing commit
6470185f
Show latest version
1 file
+
12
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
6470185f
bug fix for daily planning not supporting appointment updates
#166
· 6470185f
Valentin Groues
authored
7 years ago
smash/web/forms.py
+
12
−
3
Options
@@ -241,11 +241,20 @@ class AppointmentEditForm(ModelForm):
def
save
(
self
,
commit
=
True
):
appointment
=
super
(
AppointmentEditForm
,
self
).
save
(
commit
)
AppointmentTypeLink
.
objects
.
filter
(
appointment
=
appointment
).
delete
()
appointment_type_links
=
AppointmentTypeLink
.
objects
.
filter
(
appointment
=
appointment
).
all
()
appointment_types_from_links
=
[]
appointment_types
=
self
.
cleaned_data
[
'
appointment_types
'
]
for
appointment_type_link
in
appointment_type_links
:
if
appointment_type_link
.
appointment_type
not
in
appointment_types
:
# we delete appointment links for appointments types that have been removed
appointment_type_link
.
delete
()
else
:
appointment_types_from_links
.
append
(
appointment_type_link
.
appointment_type
)
for
appointment_type
in
appointment_types
:
appointment_type_link
=
AppointmentTypeLink
(
appointment
=
appointment
,
appointment_type
=
appointment_type
)
appointment_type_link
.
save
()
if
appointment_type
not
in
appointment_types_from_links
:
# we create new appointment links for appointements types that have been added
appointment_type_link
=
AppointmentTypeLink
(
appointment
=
appointment
,
appointment_type
=
appointment_type
)
appointment_type_link
.
save
()
return
appointment
Loading