错误内容如下
ERRORS:
audit.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'.audit.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'.auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'UserProfile.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 reverse accessor for 'UserProfile.user_permissions'. HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'UserProfile.user_permissions'.
解决方案
需要在setting中重载AUTH_USER_MODEL
AUTH_USER_MODEL = 'users.UserProfile'users:你的app
UserProfile:model
比如我的app名字叫audit那么此处就写
AUTH_USER_MODEL = "audit.UserProfile"
再次执行
python manage.py makemigrations
可以看到执行正常
转载于:https://www.cnblogs.com/qinhan/p/8308814.html