修改settings
vi project/settings.py
AUTH_USER_MODEL = 'app1.UserProfile'
添加模型类
vi project/app1/models.py
from django.contrib.auth.models import AbstractUser
class UserProfile(AbstractUser):
note = models.CharField(max_length=30)
注册到admin
vi project/app1/admin.py
from .models import UserProfile
@admin.register(UserProfile)
class UserAdmin(admin.ModelAdmin):
list_display = ('note')
参考: https://blog.csdn.net/gamer_gyt/article/details/50499653