api.v1.serializers.account_serializers package¶
api.v1.serializers.account_serializers package containing serializers for the core.models.Account data.
- class api.v1.serializers.account_serializers.AccountSerializer(*args, **kwargs)[source]¶
Bases:
BaseAccountSerializerThe standard serializer for a
core.models.Account.Includes a nested serializer for the related field mailboxes.
- _declared_fields = {'mailboxes': BaseMailboxSerializer(many=True, read_only=True): id = BigIntegerField(label='ID', read_only=True) is_favorite = BooleanField(label='Favorite status', required=False) is_healthy = BooleanField(allow_null=True, label='Health status', read_only=True) last_error = CharField(read_only=True, style={'base_template': 'textarea.html'}) last_error_occurred_at = DateTimeField(allow_null=True, label='Time of last error occurrence', read_only=True) created = DateTimeField(label='Time of creation', read_only=True) updated = DateTimeField(label='Time of last update', read_only=True) name = CharField(read_only=True) type = ChoiceField(choices=[('INBOX', 'Inbox'), ('OUTBOX', 'Outbox'), ('SENT', 'Sent'), ('JUNK', 'Junk'), ('DRAFTS', 'Drafts'), ('TRASH', 'Trash'), ('', '')], read_only=True) save_attachments = BooleanField(help_text='Whether the attachments from the emails in this mailbox will be saved.', required=False) save_to_eml = BooleanField(help_text='Whether the emails in this mailbox will be stored in .eml files.', label='Save as .eml', required=False) account = PrimaryKeyRelatedField(read_only=True), 'user': HiddenField(default=CurrentUserDefault())}¶
- mailboxes¶
The mailboxes of the account are serialized by
core.models.MailboxSerializers.BaseMailboxSerializer.BaseMailboxSerializer.
- class api.v1.serializers.account_serializers.BaseAccountSerializer(*args, **kwargs)[source]¶
Bases:
ModelSerializerThe base serializer for
core.models.Account.Includes all viable fields from the model. Sets all constraints that must be implemented in all serializers. Other serializers for
core.models.Accountshould inherit from this.- user¶
The
core.models.Account.Account.userfield is included but hidden.
- 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_fieldsandexcludemust not be shortened in subclasses.- fields = '__all__'¶
Include all fields.
- read_only_fields: Final[list[str]] = ['is_healthy', 'last_error', 'last_error_occurred_at', 'created', 'updated']¶
The
core.models.Account.Account.is_healthy,core.models.Account.Account.createdandcore.models.Account.Account.updatedfields are read-only.
- extra_kwargs = {'password': {'write_only': True}}¶
The
core.models.Account.Account.passwordfield is set to write-only for security reasons.
- _declared_fields = {'user': HiddenField(default=CurrentUserDefault())}¶