自定义用户模型类之后,迁移报错
python manage.py makemigrations
迁移文件报错
SystemCheckError: System check identified some issues:
essor for 'auth.User.groups'.
HINT: Add or change a related_name argument to the definition for 'users.UserModel.groups' or 'auth.User.groups'.
users.UserModel.user_permissions: (fields.E304) Reverse accessor for 'users.UserModel.user_permissions' clashes with reverse accessor for 'auth.User.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'users.UserModel.user_permissions' or 'auth.User.user_permissions'.
解决方法:
# 在setting中添加自定义用户模型类(应用名.模型类名)
例:AUTH_USER_MODEL = 'users.UserModel'
解决
Migrations for 'users':
users\migrations\0001_initial.py
- Create model UserModel
- Create model UserFocus