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

Posted 笃行1995

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse acce相关的知识,希望对你有一定的参考价值。

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的自建的用来判定密码或账号的表。


















以上是关于auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse acce的主要内容,如果未能解决你的问题,请参考以下文章

Django继承AbstractUser新建User Model时出现fields.E304错误

Oracle 查询 where field1=field2 and field2=field1

按 Field1 Field2 Field3 ASC 和 DESC 对查询结果进行排序

MYSQL ( field1, field2 ) = (x,y) vs field1= x AND field2 = Y 的区别

TP框架中field查询字段

如何处理大型嵌套对象的缓存