As the model inherits the AbstractUser class, an error is reported when the migration database command is executed. The specific error message is as follows:
zuichudemuyangdeMacBook-Pro:fiction zuichudemuyang$ python3 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 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reverse accessor for 'User.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'User.user_permissions'.
myadmin.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'.
myadmin.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reverse accessor for 'User.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'User.user_permissions'.
Because we forgot to add configuration verification model in settings
格式:
AUTH_USER_MODEL = '项目中app名字.models类名'
案例:
AUTH_USER_MODEL = 'myadmin.User'
If the guest officer helps you, remember to give Xiao Er a like, and Xiao Er will work harder.