2021-12-05 13:50:34 +01:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
from users.models import User
|
|
|
|
|
|
|
|
|
|
|
|
class UserSerializer(serializers.ModelSerializer):
|
2021-12-05 15:23:29 +01:00
|
|
|
|
|
|
|
password = serializers.CharField(
|
|
|
|
write_only=True,
|
|
|
|
required=False,
|
|
|
|
min_length=8,
|
|
|
|
style={"input_type": "password"},
|
|
|
|
)
|
|
|
|
#todo
|
|
|
|
# avatar = serializers.ImageField(allow_empty_file=True, source="profile.avatar", read_only=True)
|
|
|
|
|
2021-12-05 13:50:34 +01:00
|
|
|
class Meta:
|
|
|
|
model = User
|
|
|
|
fields = (
|
|
|
|
"id",
|
|
|
|
"email",
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"is_active",
|
|
|
|
"password"
|
|
|
|
)
|