mirror of
https://github.com/more-tech4-magnum-opus/backend.git
synced 2024-11-25 04:33:44 +03:00
29 lines
682 B
Python
29 lines
682 B
Python
|
from rest_framework import serializers
|
||
|
|
||
|
from users.models import User
|
||
|
|
||
|
|
||
|
class UserSerializer(serializers.ModelSerializer):
|
||
|
class Meta:
|
||
|
model = User
|
||
|
fields = [
|
||
|
"about",
|
||
|
"name",
|
||
|
"type",
|
||
|
"telegram",
|
||
|
"password",
|
||
|
"salary",
|
||
|
"respect",
|
||
|
"wallet_public_key",
|
||
|
]
|
||
|
extra_kwargs = {
|
||
|
"password": {"write_only": True},
|
||
|
"wallet_public_key": {"read_only": True},
|
||
|
}
|
||
|
|
||
|
def create(self, validated_data):
|
||
|
user = User.objects.create(
|
||
|
**validated_data, username=validated_data["telegram"]
|
||
|
)
|
||
|
return user
|