错误详情如下:

(venv) D:\workspace\music>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 '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.us
er_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'.

解决办法:

在setting.py文件中重载AUTH_USER_MODEL

# 配置自定义用户表MyUser
AUTH_USER_MODEL = 'user.MyUser'

user: 为自己的app名称

MyUser:为自己的表名称(model名称)

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

请各位大虾赐教!

05-11 15:49