SystemCheckError: System check identified some issues

58 views Asked by At
ERRORS:
auth.User.groups: (fields.E304) Reverse accessor 'Group.user_set' for 'auth.User.groups' clashes with reverse accessor for 'user.User.groups'.
        HINT: Add or change a related_name argument to the definition for 'auth.User.groups' or 'user.User.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor 'Permission.user_set' for 'auth.User.user_permissions' clashes with reverse accessor for 'user.User.user_permissions'.
        HINT: Add or change a related_name argument to the definition for 'auth.User.user_permissions' or 'user.User.user_permissions'.
user.User.groups: (fields.E304) Reverse accessor 'Group.user_set' for 'user.User.groups' clashes with reverse accessor for 'auth.User.groups'.
        HINT: Add or change a related_name argument to the definition for 'user.User.groups' or 'auth.User.groups'.
user.User.user_permissions: (fields.E304) Reverse accessor 'Permission.user_set' for 'user.User.user_permissions' clashes with reverse accessor for 'auth.User.user_permissions'.
        HINT: Add or change a related_name argument to the definition for 'user.User.user_permissions' or 'auth.User.user_permissions'.

my models

class User(AbstractUser):
    name = models.CharField(max_length=50, verbose_name=_('name'))
    profile = models.ImageField(upload_to='images/profile/', verbose_name=_('profile'))
    phone = models.CharField(
        _('Phone'),
        max_length=11,
        unique=True,
    )

    USERNAME_FIELD = 'phone'
    REQUIRED_FIELDS = []
    objects = UserManager()
    username = None

    class Meta:
        app_label = 'user'
        verbose_name = _("user")
        verbose_name_plural = _(" users")

    def __str__(self) -> str:
        return str(self.phone)
1

There are 1 answers

0
Mostafa Mahmoud On

Remove the old database and the migration files and re-migration because the last migration of the User model and its relations (groups, user_permissions) conflict with the updates you have made to the User model