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
e6c88a42
Commit
e6c88a42
authored
Sep 12, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop usage of validatiors.EMPTY_VALUES
parent
1f75ffc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
rest_framework/fields.py
+5
-5
No files found.
rest_framework/fields.py
View file @
e6c88a42
...
@@ -223,7 +223,7 @@ class Field(object):
...
@@ -223,7 +223,7 @@ class Field(object):
return
value
return
value
def
run_validators
(
self
,
value
):
def
run_validators
(
self
,
value
):
if
value
in
validators
.
EMPTY_VALUES
:
if
value
in
(
None
,
''
,
[],
(),
{})
:
return
return
errors
=
[]
errors
=
[]
...
@@ -450,7 +450,7 @@ class DecimalField(Field):
...
@@ -450,7 +450,7 @@ class DecimalField(Field):
than max_digits in the number, and no more than decimal_places digits
than max_digits in the number, and no more than decimal_places digits
after the decimal point.
after the decimal point.
"""
"""
if
value
in
validators
.
EMPTY_VALUES
:
if
value
in
(
None
,
''
)
:
return
None
return
None
value
=
smart_text
(
value
)
.
strip
()
value
=
smart_text
(
value
)
.
strip
()
...
@@ -521,7 +521,7 @@ class DateField(Field):
...
@@ -521,7 +521,7 @@ class DateField(Field):
super
(
DateField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
DateField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
to_internal_value
(
self
,
value
):
def
to_internal_value
(
self
,
value
):
if
value
in
validators
.
EMPTY_VALUES
:
if
value
in
(
None
,
''
)
:
return
None
return
None
if
isinstance
(
value
,
datetime
.
datetime
):
if
isinstance
(
value
,
datetime
.
datetime
):
...
@@ -580,7 +580,7 @@ class DateTimeField(Field):
...
@@ -580,7 +580,7 @@ class DateTimeField(Field):
super
(
DateTimeField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
DateTimeField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
to_internal_value
(
self
,
value
):
def
to_internal_value
(
self
,
value
):
if
value
in
validators
.
EMPTY_VALUES
:
if
value
in
(
None
,
''
)
:
return
None
return
None
if
isinstance
(
value
,
datetime
.
datetime
):
if
isinstance
(
value
,
datetime
.
datetime
):
...
@@ -645,7 +645,7 @@ class TimeField(Field):
...
@@ -645,7 +645,7 @@ class TimeField(Field):
super
(
TimeField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
TimeField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
from_native
(
self
,
value
):
def
from_native
(
self
,
value
):
if
value
in
validators
.
EMPTY_VALUES
:
if
value
in
(
None
,
''
)
:
return
None
return
None
if
isinstance
(
value
,
datetime
.
time
):
if
isinstance
(
value
,
datetime
.
time
):
...
...
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