1、問題
在Django中使用自定義的model的時候會出現下面的錯誤html
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'.
2、解決app
這個錯誤是因爲系統沒有識別User本身加載的類,所以須要用戶本身設定加載的model:【AUTH_USER_MODEL = '[apps的名稱].[自定義的model名]'】
1.app和model的配置
spa
2.在setting中的設置code