api.v1.serializers.account_serializers.BaseAccountSerializer module

Module with the BaseAccountSerializer serializer class.

class api.v1.serializers.account_serializers.BaseAccountSerializer.BaseAccountSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

The 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.Account should inherit from this.

user

The core.models.Account.Account.user field is included but hidden.

class Meta[source]

Bases: object

Metadata class for the base serializer.

Contains constraints that must be implemented by all serializers. Other serializer metaclasses should inherit from this. read_only_fields and exclude must not be shortened in subclasses.

model

The model to serialize.

alias of Account

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.created and core.models.Account.Account.updated fields are read-only.

extra_kwargs = {'password': {'write_only': True}}

The core.models.Account.Account.password field is set to write-only for security reasons.

_declared_fields = {'user': HiddenField(default=CurrentUserDefault())}
validate(attrs)[source]

Include full model-side validation to allow testing of account on submission.

Parameters:

attrs (dict[str, Any]) – The attributes on the serializer.

Return type:

dict[str, Any]

Returns:

The same attributes.

Raises:

serializers.ValidationError – If the validation fails.