In django, user creation has a different and unique thread from a regular instance of a model instance. You need to call create_user() , which is the BaseUserManager method.
Since the django REST framework thread must do restore_object() and then save_object() , it’s not possible to simply create users using ModelSerializer at the common endpoint of the authoring API without hacking you.
What will be a clean way to solve this problem? or at least make it work using the django built-in pipeline?
Edit:
It’s important to note that what specifically doesn’t work is that after trying to authenticate the created user instance with django.contrib.auth.authenticate it fails if the instance was just created using User.objects.create() , not .create_user() .
python django django-rest-framework
ydaniv
source share