Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
4404d40f
Commit
4404d40f
authored
Sep 06, 2015
by
Xavier Ordoquy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only pass allow_empty to the `ListSerializer` if it was in the arguments.
Helps with backward compatibility.
parent
dcdd7656
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
rest_framework/serializers.py
+3
-2
No files found.
rest_framework/serializers.py
View file @
4404d40f
...
@@ -113,12 +113,13 @@ class BaseSerializer(Field):
...
@@ -113,12 +113,13 @@ class BaseSerializer(Field):
kwargs['child'] = cls()
kwargs['child'] = cls()
return CustomListSerializer(*args, **kwargs)
return CustomListSerializer(*args, **kwargs)
"""
"""
allow_empty
=
kwargs
.
pop
(
'allow_empty'
,
Tru
e
)
allow_empty
=
kwargs
.
pop
(
'allow_empty'
,
Non
e
)
child_serializer
=
cls
(
*
args
,
**
kwargs
)
child_serializer
=
cls
(
*
args
,
**
kwargs
)
list_kwargs
=
{
list_kwargs
=
{
'child'
:
child_serializer
,
'child'
:
child_serializer
,
'allow_empty'
:
allow_empty
,
}
}
if
allow_empty
is
not
None
:
list_kwargs
[
'allow_empty'
]
=
allow_empty
list_kwargs
.
update
(
dict
([
list_kwargs
.
update
(
dict
([
(
key
,
value
)
for
key
,
value
in
kwargs
.
items
()
(
key
,
value
)
for
key
,
value
in
kwargs
.
items
()
if
key
in
LIST_SERIALIZER_KWARGS
if
key
in
LIST_SERIALIZER_KWARGS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment