一、问题
在Django中使用自定义的model的时候会出现下面的错误

ERRORS:
auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'MyUser.groups'.
HINT: Add or change a related_name argument to the definition for 'User.groups' or 'MyUser.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reverse accessor for 'MyUser.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'MyUser.user_permissions'.
user.MyUser.groups: (fields.E304) Reverse accessor for 'MyUser.groups' clashes with reverse accessor for 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'MyUser.groups' or 'User.groups'.
user.MyUser.user_permissions: (fields.E304) Reverse accessor for 'MyUser.user_permissions' clashes with reverse accessor for 'User.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'MyUser.user_permissions' or 'User.user_permissions'.


二、解决

这个错误是由于系统没有识别User自己加载的类,因此需要用户自己设定加载的model:【AUTH_USER_MODEL = '[apps的名称].[自定义的model名]'】
1.app和model的配置


2.在setting中的设置

 
三、参考
https://www.cnblogs.com/bbbbbd/p/7725030.html

posted on 2019-07-10 01:13  蔚蓝色の天空  阅读(937)  评论(0编辑  收藏  举报