1. 程式人生 > >auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'Us

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的自建的用來判定密碼或賬號的表。