Adam Starrh
Adam Starrh

Reputation: 6958

Django: INSTALLED_APPS naming conflict?

I have created custom user authentication in its own app, as the docs recommended. It is named UserAuth. However, I also have a Users app which handles the various user roles for the project.

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'AlmondKing.UserAuth',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.twitter',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.linkedin',
    'formtools',
]

AUTH_USER_MODEL = 'UserAuth.AKUser'

This works fine, but when I add AlmondKing.Users to the INSTALLED_APPS, it breaks:

ERRORS:
Users.ManagerAccount.user: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
        HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.
Users.CustomerAccount.user: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
        HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.
Users.FranchiseAccount.user: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
        HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.

The above is printed out when I try to use runserver. It is referring to the three models in the Users app.

What rule have I broken?

Upvotes: 0

Views: 275

Answers (1)

Gocht
Gocht

Reputation: 10256

Check your models if you are using FK to django.contrib.auth.models.User and replace it to point your own Model UserAuth.AKUser

Upvotes: 2

Related Questions