标签:use related for djang def mod argument profile mission
错误详情:
SystemCheckError: System check identified some issues:
ERRORS:
app01.UserInfo.groups: (fields.E304) Reverse accessor for ‘UserInfo.groups‘ clashes with reverse accessor for ‘User.groups‘.
HINT: Add or change a related_name argument to the definition for ‘UserInfo.groups‘ or ‘User.groups‘.
app01.UserInfo.user_permissions: (fields.E304) Reverse accessor for ‘UserInfo.user_permissions‘ clashes with reverse accessor for ‘User.user_permissions‘.
HINT: Add or change a related_name argument to the definition for ‘UserInfo.user_permissions‘ or ‘User.user_permissions‘.
auth.User.groups: (fields.E304) Reverse accessor for ‘User.groups‘ clashes with reverse accessor for ‘UserInfo.groups‘.
HINT: Add or change a related_name argument to the definition for ‘User.groups‘ or ‘UserInfo.groups‘.
auth.User.user_permissions: (fields.E304) Reverse accessor for ‘User.user_permissions‘ clashes with reverse accessor for ‘UserInfo.user_permissions‘.
解决方案:
需要在setting中重载AUTH_USER_MODEL
AUTH_USER_MODEL = ‘users.UserProfile‘
users:你的app
UserProfile:新的user model
Django继承AbstractUser新建UserInfor Model时出现fields.E304错误
标签:use related for djang def mod argument profile mission
原文地址:https://www.cnblogs.com/hufengzi/p/django.html