module documentation

Serializers and ModelSerializers are similar to Forms and ModelForms. Unlike forms, they are not constrained to dealing with HTML output, and form encoded input. Serialization in REST framework is a two-phase process: 1. Serializers marshal between complex types like model instances, and python primitives. 2. The process of marshalling between python primitives and request and response content is handled by parsers and renderers.

Class BaseSerializer The BaseSerializer class provides a minimal class which may be used for writing custom serializer implementations.
Class HyperlinkedModelSerializer A type of `ModelSerializer` that uses hyperlinked relationships instead of primary key relationships. Specifically:
Class ListSerializer No class docstring; 0/2 property, 0/6 instance variable, 0/2 class variable, 5/12 methods documented
Class ModelSerializer A `ModelSerializer` is just a regular `Serializer`, except that:
Class Serializer No class docstring; 1/5 property, 0/1 class variable, 6/13 methods documented
Class SerializerMetaclass This metaclass sets a dictionary named `_declared_fields` on the class.
Function as_serializer_error Undocumented
Function raise_errors_on_nested_writes Give explicit errors when users attempt to pass writable nested data.
Constant ALL_FIELDS Undocumented
Constant LIST_SERIALIZER_KWARGS Undocumented
def as_serializer_error(exc): (source)

Undocumented

def raise_errors_on_nested_writes(method_name, serializer, validated_data): (source)

Give explicit errors when users attempt to pass writable nested data. If we don't do this explicitly they'd get a less helpful error when calling `.save()` on the serializer. We don't *automatically* support these sorts of nested writes because there are too many ambiguities to define a default behavior. Eg. Suppose we have a `UserSerializer` with a nested profile. How should we handle the case of an update, where the `profile` relationship does not exist? Any of the following might be valid: * Raise an application error. * Silently ignore the nested part of the update. * Automatically create a profile instance.

ALL_FIELDS: str = (source)

Undocumented

Value
'__all__'
LIST_SERIALIZER_KWARGS: tuple[str, ...] = (source)

Undocumented

Value
('read_only',
 'write_only',
 'required',
 'default',
 'initial',
 'source',
 'label',
...