Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
AURA
steering
Commits
53173268
Verified
Commit
53173268
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
fix: get the timeslot_pk from the request path if timeslot_id is missing
parent
aa7e7f41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/serializers.py
+8
-3
8 additions, 3 deletions
program/serializers.py
with
8 additions
and
3 deletions
program/serializers.py
+
8
−
3
View file @
53173268
...
@@ -787,7 +787,12 @@ class NoteSerializer(serializers.ModelSerializer):
...
@@ -787,7 +787,12 @@ class NoteSerializer(serializers.ModelSerializer):
contributors
=
validated_data
.
pop
(
"
contributors
"
,
[])
contributors
=
validated_data
.
pop
(
"
contributors
"
,
[])
# required
# required
validated_data
[
"
timeslot
"
]
=
validated_data
.
pop
(
"
timeslot_id
"
)
if
"
timeslot_id
"
in
validated_data
:
validated_data
[
"
timeslot
"
]
=
validated_data
.
pop
(
"
timeslot_id
"
)
else
:
# TODO: Once we remove nested routes, this hack should be removed
timeslot_pk
=
TimeSlot
.
objects
.
get
(
pk
=
self
.
context
[
"
request
"
].
path
.
split
(
"
/
"
)[
-
3
])
validated_data
[
"
timeslot
"
]
=
validated_data
.
pop
(
"
timeslot_id
"
,
timeslot_pk
)
# optional
# optional
validated_data
[
"
image
"
]
=
validated_data
.
pop
(
"
image_id
"
,
None
)
validated_data
[
"
image
"
]
=
validated_data
.
pop
(
"
image_id
"
,
None
)
...
@@ -826,10 +831,10 @@ class NoteSerializer(serializers.ModelSerializer):
...
@@ -826,10 +831,10 @@ class NoteSerializer(serializers.ModelSerializer):
instance
.
cba_id
=
validated_data
.
get
(
"
cba_id
"
,
instance
.
cba_id
)
instance
.
cba_id
=
validated_data
.
get
(
"
cba_id
"
,
instance
.
cba_id
)
instance
.
content
=
validated_data
.
get
(
"
content
"
,
instance
.
content
)
instance
.
content
=
validated_data
.
get
(
"
content
"
,
instance
.
content
)
instance
.
image
=
validated_data
.
get
(
"
image
"
,
instance
.
image
_id
)
instance
.
image
=
validated_data
.
get
(
"
image
_id
"
,
instance
.
image
)
instance
.
slug
=
validated_data
.
get
(
"
slug
"
,
instance
.
slug
)
instance
.
slug
=
validated_data
.
get
(
"
slug
"
,
instance
.
slug
)
instance
.
summary
=
validated_data
.
get
(
"
summary
"
,
instance
.
summary
)
instance
.
summary
=
validated_data
.
get
(
"
summary
"
,
instance
.
summary
)
instance
.
timeslot
=
validated_data
.
get
(
"
timeslot
"
,
instance
.
timeslot
_id
)
instance
.
timeslot
=
validated_data
.
get
(
"
timeslot
_id
"
,
instance
.
timeslot
)
instance
.
title
=
validated_data
.
get
(
"
title
"
,
instance
.
title
)
instance
.
title
=
validated_data
.
get
(
"
title
"
,
instance
.
title
)
instance
.
contributors
.
set
(
validated_data
.
get
(
"
contributors
"
,
instance
.
contributors
))
instance
.
contributors
.
set
(
validated_data
.
get
(
"
contributors
"
,
instance
.
contributors
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment