Difference between AbstractUser and AbstractBaseUser in Django?

后端 未结 2 1053
说谎
说谎 2020-11-30 21:10

The use of AbstractUser and AbstractBaseUser looks quite similar.

from django.contrib.auth.models import AbstractUser, AbstractBase         


        
2条回答
  •  Happy的楠姐
    2020-11-30 22:04

    The documentation explains this fully. AbstractUser is a full User model, complete with fields, as an abstract class so that you can inherit from it and add your own profile fields and methods. AbstractBaseUser only contains the authentication functionality, but no actual fields: you have to supply them when you subclass.

提交回复
热议问题