首先新建一个users应用,编写这个应用的models类。

from django.contrib.auth.models import AbstractUser

class UserProfile(AbstractUser):
  ......

然后在settings里面加入应用。

最后重载用户model,如下:

AUTH_USER_MODEL = "users.UserProfile"

 

最最后:makemigrations和migrate  根据提示输入YES,删除系统USER表,新建你自己的。

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2021-10-26
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-08-27
  • 2021-10-08
  • 2021-12-14
  • 2021-11-02
  • 2022-02-14
相关资源
相似解决方案