0

I am using django rest framework and DjangoModelPermissions, I have serialized the default User Model to get information about the users and their permissions and also admin can change the permission as per requirement from the front-end (some JavaScript) or make some user a superuser.

The problem is when admin tries to do a PUT statement with new data it fails. In User model password is the mandatory required field. I have got user's authentication token(which does not work) and i have not serialized password from users model and i don't want to.

I tried to append serialize data before saving to add one more field "password" by getting the values using user.objects.get(username=data_from_serializer_data).password but i am not able to add an extra field(password field) to serializer data.

What may be the way to achieve my goals? how can i add password value in serializer data(at back-end) and then send complete data for update.

Also i read somewhere that serializer.data is a property which can not be edited. If true what else will i have to do to complete my task?

Thanks

Ranu Vijay
  • 1,137
  • 9
  • 18

1 Answers1

0

You can add get_serializer_class in after creating a CustomUser and overriding your existing serializer.

DARK_C0D3R
  • 2,075
  • 16
  • 21