api.v1.serializers.correspondent_serializers.CorrespondentSerializer module

Module with the CorrespondentSerializer serializer class.

class api.v1.serializers.correspondent_serializers.CorrespondentSerializer.CorrespondentSerializer(*args, **kwargs)[source]

Bases: BaseCorrespondentSerializer

The standard serializer for a core.models.Correspondent.Correspondent.

Includes a nested serializer for the core.models.Correspondent.Correspondent.emails field.

emails

The emails are set from the core.models.EmailCorrespondent.EmailCorrespondent via :fu`core.models.EmailCorrespondent`

_declared_fields = {'emails': SerializerMethodField(read_only=True)}
get_emails(instance)[source]

Serializes the emails connected to the instance to be serialized.

Parameters:

instance (Correspondent) – The instance being serialized.

Return type:

ReturnDict[str, Any]

Returns:

The serialized emails connected to the instance to be serialized. An empty list if the the user is not authenticated.