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
e3991400
Commit
e3991400
authored
Nov 07, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tweaks
parent
555930ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
rest_framework/serializers.py
+6
-0
rest_framework/utils/field_mapping.py
+3
-1
No files found.
rest_framework/serializers.py
View file @
e3991400
...
...
@@ -393,6 +393,9 @@ class ListSerializer(BaseSerializer):
return
ReturnList
(
serializer
=
self
)
def
get_value
(
self
,
dictionary
):
"""
Given the input dictionary, return the field value.
"""
# We override the default field access in order to support
# lists in HTML forms.
if
html
.
is_html_input
(
dictionary
):
...
...
@@ -442,6 +445,9 @@ class ListSerializer(BaseSerializer):
)
def
save
(
self
,
**
kwargs
):
"""
Save and return a list of object instances.
"""
assert
self
.
instance
is
None
,
(
"Serializers do not support multiple update by default, only "
"multiple create. For updates it is unclear how to deal with "
...
...
rest_framework/utils/field_mapping.py
View file @
e3991400
...
...
@@ -219,9 +219,11 @@ def get_relation_kwargs(field_name, relation_info):
kwargs
[
'required'
]
=
False
if
model_field
.
null
:
kwargs
[
'allow_null'
]
=
True
if
model_field
.
validators
:
kwargs
[
'validators'
]
=
model_field
.
validators
if
getattr
(
model_field
,
'unique'
,
False
):
validator
=
UniqueValidator
(
queryset
=
model_field
.
model
.
_default_manager
)
kwargs
[
'validators'
]
=
[
validator
]
kwargs
[
'validators'
]
=
kwargs
.
get
(
'validators'
,
[])
+
[
validator
]
return
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