rest_framework.utils.serializer_helpers

Module Contents

class ReturnDict(*args, **kwargs)

Bases:collections.OrderedDict

Return object from serializer.data for the Serializer class. Includes a backlink to the serializer instance for renderers to use if they need richer field information.

copy(self)
__repr__(self)
__reduce__(self)
class ReturnList(*args, **kwargs)

Bases:list

Return object from serializer.data for the SerializerList class. Includes a backlink to the serializer instance for renderers to use if they need richer field information.

__repr__(self)
__reduce__(self)
class BoundField(field, value, errors, prefix='')

Bases:object

A field object that also includes .value and .error properties. Returned when iterating over a serializer instance, providing an API similar to Django forms and form fields.

_proxy_class
__getattr__(self, attr_name)
__repr__(self)
as_form_field(self)
class JSONBoundField

Bases:rest_framework.utils.serializer_helpers.BoundField

as_form_field(self)
class NestedBoundField(field, value, errors, prefix='')

Bases:rest_framework.utils.serializer_helpers.BoundField

This BoundField additionally implements __iter__ and __getitem__ in order to support nested bound fields. This class is the type of BoundField that is used for serializer fields.

__iter__(self)
__getitem__(self, key)
as_form_field(self)
class BindingDict(serializer)

Bases:rest_framework.compat.MutableMapping

This dict-like object is used to store fields on a serializer.

This ensures that whenever fields are added to the serializer we call field.bind() so that the field_name and parent attributes can be set correctly.

__setitem__(self, key, field)
__getitem__(self, key)
__delitem__(self, key)
__iter__(self)
__len__(self)
__repr__(self)