模板继承AbstractUser报错:
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'.
autoo.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'.
autoo.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'.
class User(AbstractUser):
= models.IntegerField(=,=,=) user_role_name = models.ForeignKey(Role,=, =models.CASCADE, =) user_describe = models.TextField(=,=,=,=) user_avatar = models.ImageField(=,=,=,=,=,=)
在项目中的settings.py 文件中加入:
AUTH_USER_MODEL = '项目名称.User'
问题解决
转载于:https://blog.51cto.com/xiaoo/1883535