Search code examples
djangodjango-modelsdjango-rest-frameworkdjango-rest-framework-simplejwtdjoser

Unable to create account --- Djoser, Django_Rest_Framework


My Custom Model

enter image description here

My Custom Serializer

enter image description here

My Custom Manager

enter image description here

My Error enter image description here


Solution

  • You need to inherit from AbstractBaseUser, not from AbstractUser

    from django.contrib.auth.base_user import AbstractBaseUser
    from django.contrib.auth.models import PermissionsMixin
    
    
    class CustomUser(AbstractBaseUser, PermissionsMixin):
        # put your fields here 
        is_superuser = models.BooleanField(default=False)
        is_staff = models.BooleanField(default=False)
        is_active = models.BooleanField(default=True)
    
    

    and in settings.py file

    AUTH_USER_MODEL = 'your_app_name.CustomUser'