SOITA/users/serializers.py
2021-12-05 15:23:29 +01:00

27 lines
598 B
Python

from rest_framework import serializers
from users.models import User
class UserSerializer(serializers.ModelSerializer):
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)
class Meta:
model = User
fields = (
"id",
"email",
"first_name",
"last_name",
"is_active",
"password"
)