mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Tidying
This commit is contained in:
parent
e4ac566625
commit
f1e665673f
|
@ -95,15 +95,19 @@ class SerializerOptions(object):
|
||||||
|
|
||||||
|
|
||||||
class BaseSerializer(Field):
|
class BaseSerializer(Field):
|
||||||
|
"""
|
||||||
|
This is the Serializer implementation.
|
||||||
|
We need to implement it as `BaseSerializer` due to metaclass magicks.
|
||||||
|
"""
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
_options_class = SerializerOptions
|
_options_class = SerializerOptions
|
||||||
_dict_class = SortedDictWithMetadata # Set to unsorted dict for backwards compatibility with unsorted implementations.
|
_dict_class = SortedDictWithMetadata
|
||||||
|
|
||||||
def __init__(self, instance=None, data=None, files=None,
|
def __init__(self, instance=None, data=None, files=None,
|
||||||
context=None, partial=False, **kwargs):
|
context=None, partial=False, source=None):
|
||||||
super(BaseSerializer, self).__init__(**kwargs)
|
super(BaseSerializer, self).__init__(source=source)
|
||||||
self.opts = self._options_class(self.Meta)
|
self.opts = self._options_class(self.Meta)
|
||||||
self.parent = None
|
self.parent = None
|
||||||
self.root = None
|
self.root = None
|
||||||
|
@ -347,6 +351,9 @@ class BaseSerializer(Field):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self):
|
||||||
|
"""
|
||||||
|
Returns the serialized data on the serializer.
|
||||||
|
"""
|
||||||
if self._data is None:
|
if self._data is None:
|
||||||
self._data = self.to_native(self.object)
|
self._data = self.to_native(self.object)
|
||||||
return self._data
|
return self._data
|
||||||
|
|
Loading…
Reference in New Issue
Block a user