api.v1.serializers.correspondent_serializers package¶
api.v1.serializers.Correspondent_serializers package containing serializers for the core.models.Correspondent data.
- class api.v1.serializers.correspondent_serializers.BaseCorrespondentSerializer(*args, **kwargs)[source]¶
Bases:
ModelSerializerThe base serializer for
core.models.Correspondent.Includes all viable fields from the model. Sets all constraints that must be implemented in all serializers. Other serializers for
core.models.Correspondentshould inherit from this.- class Meta[source]¶
Bases:
objectMetadata class for the base serializer.
Contains constraints that must be implemented by all serializers. Other serializer metaclasses should inherit from this.
read_only_fieldsmust not be shortened in subclasses.- model¶
alias of
Correspondent
- exclude: Final[list[str]] = ['user']¶
Exclude only the
core.models.Correspondent.Correspondent.userfield.
- read_only_fields: Final[list[str]] = ['email_address', 'email_name', 'list_id', 'list_owner', 'list_subscribe', 'list_unsubscribe', 'list_unsubscribe_post', 'list_post', 'list_help', 'list_archive', 'created', 'updated']¶
The
core.models.Correspondent.Correspondent.email_address,core.models.Correspondent.Correspondent.createdandcore.models.Correspondent.Correspondent.updatedfields are read-only.
- _declared_fields = {}¶
- class api.v1.serializers.correspondent_serializers.CorrespondentSerializer(*args, **kwargs)[source]¶
Bases:
BaseCorrespondentSerializerThe standard serializer for a
core.models.Correspondent.Correspondent.Includes a nested serializer for the
core.models.Correspondent.Correspondent.emailsfield.- emails¶
The emails are set from the
core.models.EmailCorrespondent.EmailCorrespondentvia :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:
- Returns:
The serialized emails connected to the instance to be serialized. An empty list if the the user is not authenticated.