0

Django shows this error when migrating

SystemCheckError: System check identified some issues:

ERRORS:
accounts.CustomUser.groups: (fields.E304) Reverse accessor for 'accounts.CustomUser.groups' clashes with reverse accessor for 'auth.User.groups'.
        HINT: Add or change a related_name argument to the definition for 'accounts.CustomUser.groups' or 'auth.User.groups'.
accounts.CustomUser.user_permissions: (fields.E304) Reverse accessor for 'accounts.CustomUser.user_permissions' clashes with reverse accessor for 'auth.User.user_permissions'.
        HINT: Add or change a related_name argument to the definition for 'accounts.CustomUser.user_permissions' or 'auth.User.user_permissions'.
auth.User.groups: (fields.E304) Reverse accessor for 'auth.User.groups' clashes with reverse accessor for 'accounts.CustomUser.groups'.
        HINT: Add or change a related_name argument to the definition for 'auth.User.groups' or 'accounts.CustomUser.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'auth.User.user_permissions' clashes with reverse accessor for 'accounts.CustomUser.user_permissions'.
        HINT: Add or change a related_name argument to the definition for 'auth.User.user_permissions' or 'accounts.CustomUser.user_permissions'.

It is suggesting to add related_name but I have not user any ForeignKey Field in my model, My model is inheriting from the AbstractUser

models.py

from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.

class CustomUser(AbstractUser):
    USER_TYPE_CHOICES = (
        (1, 'CUSTOMER'),
        (2, 'AGENT'),
        (3, 'SUPERVISOR'),
    )
    user_type = models.PositiveSmallIntegerField(choices=USER_TYPE_CHOICES)

1 Answers1

2

Add AUTH_USER_MODEL in your settings.py for your custom user model as

AUTH_USER_MODEL = 'your_app_name.CustomUser'
user8193706
  • 2,387
  • 2
  • 8
  • 12