更新时间:2023-09-16 10:50:10
尽管将ProjectUser设置为AUTH_USER_MODEL,但您在admin中将其注册为标准模型,而不是用户模型.您需要使用用户admin,如
Although you set ProjectUser to be the AUTH_USER_MODEL, you registered it in the admin as a standard model, not the user one. You need to use the user admin, as shown in the docs, since this takes care of hashing the password:
from django.contrib.auth.admin import UserAdmin
admin.site.register(ProjectUser, UserAdmin)
您需要先删除并重新创建通过管理员生成的用户,然后再进行更改.
You'll need to delete and recreate the users you generated via the admin before changing this.