pytoolbox.rest_framework.serializers.mixins module

Mix-ins for building your own Django REST Framework powered API serializers.

class pytoolbox.rest_framework.serializers.mixins.BaseModelMixin[source]

Bases: object

build_url_field(field_name, model_class)[source]
class pytoolbox.rest_framework.serializers.mixins.FromPrivateKeyMixin[source]

Bases: object

Allow to provide the PK of the model to retrieve it instead of creating a new instance with fields from data.

default_error_messages
to_internal_value(data)[source]

Transform the incoming primitive data into a native value.

create(validated_data)[source]
class pytoolbox.rest_framework.serializers.mixins.NestedWriteMixin[source]

Bases: object

to_internal_value(data)[source]

Return a tuple with (self, validate_data) to allow working on validated data with this serializer.

class pytoolbox.rest_framework.serializers.mixins.ReadOnlyMixin(*args, **kwargs)[source]

Bases: object

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

create(validated_data)[source]
update(task, validated_data)[source]