What Is The Difference between AbstractUser and AbstractBaseUser in Django ?

It is important to understand the difference between AbstractUser and AbstractBaseUser in Django, this will help you make the right decision on which one to use when you are starting a Django project.

 

AbstractUser

 

Django documentation says that AbstractUser provides the full implementation of the default User as an abstract model, which means you will get the complete fields which come with User model plus the fields that you define.

 

Example


from django.db import models
from django.contrib.auth.models import AbstractUser



class MyUser(AbstractUser):
    address = models.CharField(max_length=30, blank=True)
    birth_date = models.DateField()

In the above example, you will get all the fields of the User model plus the fields we defined here which are address and birth_date

Back to Top