magic_notifier.serializers

Module Contents

Classes

NotificationSerializer

A ModelSerializer is just a regular Serializer, except that:

class magic_notifier.serializers.NotificationSerializer(instance=None, data=empty, **kwargs)

Bases: rest_framework.serializers.ModelSerializer

A ModelSerializer is just a regular Serializer, except that:

  • A set of default fields are automatically populated.

  • A set of default validators are automatically populated.

  • Default .create() and .update() implementations are provided.

The process of automatically determining a set of serializer fields based on the model fields is reasonably complex, but you almost certainly don’t need to dig into the implementation.

If the ModelSerializer class doesn’t generate the set of fields that you need you should either declare the extra/differing fields explicitly on the serializer class, or simply use a Serializer class.

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta
model
fields = ('id', 'subject', 'text', 'type', 'sub_type', 'link', 'mode', 'image', 'actions', 'data', 'read', 'sent')