I have a custom user for authentication and want to create a serializer class for it my custom user's model is like this :
class User (AbstractUser):
bio = models.TextField(max_length=500, blank=True)
birth_date = models.DateField(null=True, blank=True)
image=models.FileField(null=True , blank=True)
and my serializer is :
class UserSerializer (serializers.ModelSerializer):
class Meta:
model = User
fields = ('username' ,'email' ,'password' ,'firstname' , 'last name' )
how could I mention that the password field is a password and its content must be hashed?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…