1๐
โ
As was mentioned in the comments, if you just set password in a user serializer, your password will be saved in plaintext where Django expects a hash. So you need to do something like this
class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id','username','email','password','is_active') def create(self, validated_data): user = super().create(validated_data) if 'password' in validated_data: user.set_password(validated_data['password']) user.save() return user
๐คMad Wombat
Source:stackexchange.com