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
28ae2646
Commit
28ae2646
authored
Mar 08, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3k fixes.
parent
0b6267d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
rest_framework/serializers.py
+4
-4
rest_framework/tests/serializer.py
+1
-1
No files found.
rest_framework/serializers.py
View file @
28ae2646
...
...
@@ -7,8 +7,7 @@ from django.core.paginator import Page
from
django.db
import
models
from
django.forms
import
widgets
from
django.utils.datastructures
import
SortedDict
from
rest_framework.compat
import
get_concrete_model
from
rest_framework.compat
import
six
from
rest_framework.compat
import
get_concrete_model
,
six
# Note: We do the following so that users of the framework can use this style:
#
...
...
@@ -326,7 +325,7 @@ class BaseSerializer(Field):
if
self
.
many
is
not
None
:
many
=
self
.
many
else
:
many
=
hasattr
(
obj
,
'__iter__'
)
and
not
isinstance
(
obj
,
(
Page
,
dict
))
many
=
hasattr
(
obj
,
'__iter__'
)
and
not
isinstance
(
obj
,
(
Page
,
dict
,
six
.
text_type
))
if
many
:
return
[
self
.
to_native
(
item
)
for
item
in
obj
]
...
...
@@ -344,7 +343,7 @@ class BaseSerializer(Field):
if
self
.
many
is
not
None
:
many
=
self
.
many
else
:
many
=
hasattr
(
data
,
'__iter__'
)
and
not
isinstance
(
data
,
(
Page
,
dict
))
many
=
hasattr
(
data
,
'__iter__'
)
and
not
isinstance
(
data
,
(
Page
,
dict
,
six
.
text_type
))
if
many
:
warnings
.
warn
(
'Implict list/queryset serialization is due to be deprecated. '
'Use the `many=True` flag when instantiating the serializer.'
,
...
...
@@ -362,6 +361,7 @@ class BaseSerializer(Field):
if
not
self
.
_errors
:
self
.
object
=
ret
return
self
.
_errors
def
is_valid
(
self
):
...
...
rest_framework/tests/serializer.py
View file @
28ae2646
...
...
@@ -1108,5 +1108,5 @@ class DeserializeListTestCase(TestCase):
serializer
=
CommentSerializer
(
data
=
data
)
self
.
assertFalse
(
serializer
.
is_valid
())
expected
=
[{},
{
'email'
:
[
u
'This field is required.'
]},
{}]
expected
=
[{},
{
'email'
:
[
'This field is required.'
]},
{}]
self
.
assertEqual
(
serializer
.
errors
,
expected
)
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