serializers
A module that contains serializers of the users package.
Classes
UserSerializer
: A class that serializer the AuthUser model.
UserSerializer
Bases: serializers.ModelSerializer
Serializer for the AuthUser model.
Attributes:
Name | Type | Description |
---|---|---|
password |
serializers.CharField
|
The password of the user and it is written only |
Methods
validate_password(password)
: A method to validate the user password when registering
Source code in backend/api/users/serializers.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
Meta
Metaclass for UserSerializer.
Attributes:
Name | Type | Description |
---|---|---|
model |
AuthUser
|
The AuthUser model |
fields |
list[str]
|
A list of AuthUser fields that need to be serialized |
Source code in backend/api/users/serializers.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
validate_password(password)
Validate the entered password.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
password |
str
|
The password entered by the user. |
required |
Raises:
Type | Description |
---|---|
serializers.ValidationError
|
If the password is less than 8 characters. |
Returns:
Type | Description |
---|---|
str
|
The validated password. |
Source code in backend/api/users/serializers.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|