[Django]-Auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'UserManage.groups'

309👍

Add the following to settings.py:

AUTH_USER_MODEL = "users_management.UserManage" 

More generally,

AUTH_USER_MODEL = 'YourAppName.YourClassName'
  • YourAppName: This is the name of the app that will have the User Model
  • YourClassName: This is the name of the class used inside the models.py file

31👍

Add this in the settings :

AUTH_USER_MODEL = 'APPNAME.User'

This way we are telling Django to use our custom model instead the default one.
https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#substituting-a-custom-user-model

12👍

The solution is to first add the following line into your settings.py-

AUTH_USER_MODEL="myproject.User"

Where myproject is your project name.
If you again get error then run following commands in your main directory-

python manage.py makemigrations
python manage.py migrate

This worked for me

10👍

Add this setting.py
AUTH_USER_MODEL = "myapp.User"

8👍

Add this in the settings at the end of the code :

AUTH_USER_MODEL="users.CustomUser"

2👍

Just add AUTH_USER_MODEL="your app name.User" in settings.py as shown in the code below

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
AUTH_USER_MODEL="myproject.User"
    
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
    
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

0👍

If above steps don´t work, delete all migrations history and your database.

Then "makemigrations" and "migrate" like it was for the first time.

The User model must be created at beginning of the project, before firts migration.

Leave a comment