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
55e9cbec
Commit
55e9cbec
authored
Oct 04, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks
parent
aac6b6cf
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 @
55e9cbec
...
@@ -6,7 +6,6 @@ import warnings
...
@@ -6,7 +6,6 @@ import warnings
from
django.core
import
validators
from
django.core
import
validators
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
from
django.conf
import
settings
from
django.conf
import
settings
from
django.db
import
DEFAULT_DB_ALIAS
from
django.utils.encoding
import
is_protected_type
,
smart_unicode
from
django.utils.encoding
import
is_protected_type
,
smart_unicode
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.reverse
import
reverse
from
rest_framework.reverse
import
reverse
...
@@ -27,6 +26,7 @@ def is_simple_callable(obj):
...
@@ -27,6 +26,7 @@ def is_simple_callable(obj):
class
Field
(
object
):
class
Field
(
object
):
creation_counter
=
0
creation_counter
=
0
empty
=
''
empty
=
''
type_name
=
None
def
__init__
(
self
,
source
=
None
):
def
__init__
(
self
,
source
=
None
):
self
.
parent
=
None
self
.
parent
=
None
...
@@ -90,7 +90,7 @@ class Field(object):
...
@@ -90,7 +90,7 @@ class Field(object):
"""
"""
Returns a dictionary of attributes to be used when serializing to xml.
Returns a dictionary of attributes to be used when serializing to xml.
"""
"""
if
getattr
(
self
,
'type_name'
,
None
)
:
if
self
.
type_name
:
return
{
'type'
:
self
.
type_name
}
return
{
'type'
:
self
.
type_name
}
return
{}
return
{}
...
@@ -233,8 +233,10 @@ class ManyRelatedField(RelatedField):
...
@@ -233,8 +233,10 @@ class ManyRelatedField(RelatedField):
def
field_from_native
(
self
,
data
,
field_name
,
into
):
def
field_from_native
(
self
,
data
,
field_name
,
into
):
try
:
try
:
# Form data
value
=
data
.
getlist
(
self
.
source
or
field_name
)
value
=
data
.
getlist
(
self
.
source
or
field_name
)
except
:
except
:
# Non-form data
value
=
data
.
get
(
self
.
source
or
field_name
)
value
=
data
.
get
(
self
.
source
or
field_name
)
else
:
else
:
if
value
==
[
''
]:
if
value
==
[
''
]:
...
...
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