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 |
|
The BaseSerializer class provides a minimal class which may be used for writing custom serializer implementations. |
Class |
|
A type of `ModelSerializer` that uses hyperlinked relationships instead of primary key relationships. Specifically: |
Class |
|
No class docstring; 0/2 property, 0/6 instance variable, 0/2 class variable, 5/12 methods documented |
Class |
|
A `ModelSerializer` is just a regular `Serializer`, except that: |
Class |
|
No class docstring; 1/5 property, 0/1 class variable, 6/13 methods documented |
Class |
|
This metaclass sets a dictionary named `_declared_fields` on the class. |
Function | as |
Undocumented |
Function | raise |
Give explicit errors when users attempt to pass writable nested data. |
Constant | ALL |
Undocumented |
Constant | LIST |
Undocumented |
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.