UserSerializer
Overview
This is a public API, don't just change it without considering the impact.
This is used to list, create, update, and delete users.
Meta
Source
server/vueda/user/serializers.py:125
create
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop('example_relationship')
instance = ExampleModel.objects.create(**validated_data)
instance.example_relationship = example_relationship
return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you'll need to write an explicit .create() method.
Signature
create(self, validated_data)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| validated_data | yes |
Source
server/vueda/user/serializers.py:177
to_internal_value
?e= (expand) names relations whose payload is a nested object rather than a flat PK, so each expanded relation is swapped for its nested serializer here, before deserialization, to accept that shape. See the nested-writable-inlines guide for the query-param contract; this half of flex-field handling is independent of sparse-fieldset narrowing and stays on the write path.
?f=/?om= are not applied here. They narrow the representation only, in to_representation (via ensure_flex_fields_applied), so a required field they exclude still fails validation instead of silently losing its validator. Deserialization must not call ensure_flex_fields_applied for this reason: that helper runs the full apply_flex_fields, sparse-fieldset removal included, which is exactly what would drop the validator.
Signature
to_internal_value(self, data)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| data | yes |
Source
server/vueda/user/serializers.py:148
update
Signature
update(self, instance, validated_data)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| instance | yes | ||
| validated_data | yes |
Source
server/vueda/user/serializers.py:191
validate_password
Signature
validate_password(self, value)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| value | yes |
Source
server/vueda/user/serializers.py:164
validate_password_confirm
Signature
validate_password_confirm(self, value)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| value | yes |
Source
server/vueda/user/serializers.py:171
TEMPORARY_PASSWORD
_declared_fields
_used_temp_password
password_confirm
send_welcome_email_on_create
Source
server/vueda/user/serializers.py:110