mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-27 03:54:01 +03:00
28 tests passes now.
This commit is contained in:
parent
be003145ca
commit
4007b56457
|
@ -1,3 +1,5 @@
|
||||||
|
import six
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import types
|
import types
|
||||||
|
@ -54,7 +56,7 @@ def _get_declared_fields(bases, attrs):
|
||||||
Note that all fields from the base classes are used.
|
Note that all fields from the base classes are used.
|
||||||
"""
|
"""
|
||||||
fields = [(field_name, attrs.pop(field_name))
|
fields = [(field_name, attrs.pop(field_name))
|
||||||
for field_name, obj in attrs.items()
|
for field_name, obj in list(six.iteritems(attrs))
|
||||||
if isinstance(obj, Field)]
|
if isinstance(obj, Field)]
|
||||||
fields.sort(key=lambda x: x[1].creation_counter)
|
fields.sort(key=lambda x: x[1].creation_counter)
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ def _get_declared_fields(bases, attrs):
|
||||||
# in order to the correct order of fields.
|
# in order to the correct order of fields.
|
||||||
for base in bases[::-1]:
|
for base in bases[::-1]:
|
||||||
if hasattr(base, 'base_fields'):
|
if hasattr(base, 'base_fields'):
|
||||||
fields = base.base_fields.items() + fields
|
fields = list(base.base_fields.items()) + fields
|
||||||
|
|
||||||
return SortedDict(fields)
|
return SortedDict(fields)
|
||||||
|
|
||||||
|
@ -315,8 +317,8 @@ class BaseSerializer(Field):
|
||||||
return self.object
|
return self.object
|
||||||
|
|
||||||
|
|
||||||
class Serializer(BaseSerializer):
|
class Serializer(six.with_metaclass(SerializerMetaclass, BaseSerializer)):
|
||||||
__metaclass__ = SerializerMetaclass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ModelSerializerOptions(SerializerOptions):
|
class ModelSerializerOptions(SerializerOptions):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user