Minhajul Anwar's Blog

Customizing Django Auth: Custom User Model

Customizing Django Auth: Custom User Model

2021, Jul 31    

Common Problems

django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model ‘myapp.MyUserModel’ that has not been installed

After writing your custom user model and specifying it in django settings, you run makemigrations and whoa! It fails!

  • Probable reason is you didn’t specify your custom user model in admin.py
  • You may have specified abstract = True in your custom user model Meta class. Remove it, so that it should look like:
    class Meta:
     verbose_name = _('user')
     verbose_name_plural = _('users')
     # abstract = True remove this line if exists
    

    Check the django auth doc: custom user model, a full example