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
1adfc41d
Commit
1adfc41d
authored
Nov 21, 2012
by
Mark Aaron Shirley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
partial argument should override required
parent
3b43d41e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
rest_framework/fields.py
+4
-2
No files found.
rest_framework/fields.py
View file @
1adfc41d
...
...
@@ -53,6 +53,8 @@ class Field(object):
self
.
parent
=
parent
self
.
root
=
parent
.
root
or
parent
self
.
context
=
self
.
root
.
context
if
self
.
root
.
partial
:
self
.
required
=
False
def
field_from_native
(
self
,
data
,
files
,
field_name
,
into
):
"""
...
...
@@ -148,7 +150,7 @@ class WritableField(Field):
self
.
widget
=
widget
def
validate
(
self
,
value
):
if
value
in
validators
.
EMPTY_VALUES
and
self
.
required
and
not
self
.
root
.
partial
:
if
value
in
validators
.
EMPTY_VALUES
and
self
.
required
:
raise
ValidationError
(
self
.
error_messages
[
'required'
])
def
run_validators
(
self
,
value
):
...
...
@@ -186,7 +188,7 @@ class WritableField(Field):
if
self
.
default
is
not
None
:
native
=
self
.
default
else
:
if
self
.
required
and
not
self
.
root
.
partial
:
if
self
.
required
:
raise
ValidationError
(
self
.
error_messages
[
'required'
])
return
...
...
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