auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'Us

django-1.11) F:\crm>python manage.py makemigrations
SystemCheckError: System check identified some issues:

ERRORS:
auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'Us
erProfile.groups'.
HINT: Add or change a related_name argument to the definition for 'User.groups' or 'UserProfile.
groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reve
rse accessor for 'UserProfile.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'Us
erProfile.user_permissions'.
crm_app.UserProfile.groups: (fields.E304) Reverse accessor for 'UserProfile.groups' clashes with reverse
accessor for 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'UserProfile.groups' or 'User.
groups'.
crm_app.UserProfile.user_permissions: (fields.E304) Reverse accessor for 'UserProfile.user_permissions'
clashes with reverse accessor for 'User.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'UserProfile.user_permissions'
or 'User.user_permissions'.

出现在新建model中出现fields.E304错误,极有可能是setting中的AUTH_USER_MODEL拼写或者是后面制定的表不对。

正确的结构式:

AUTH_USER_MODEL  = 'app名.表名'。

其中的表名是model中你用来代替原本默认的auth_user的自建的用来判定密码或账号的表。

猜你喜欢

转载自www.cnblogs.com/z18271397173/p/10008954.html