Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

Use Django's AUTH_USER_MODEL rather than the default User model #185

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

borwick
Copy link

@borwick borwick commented Sep 16, 2013

As referenced in the Django documentation: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#auth-custom-user

Instead of referring to User directly, you should reference the user model using django.contrib.auth.get_user_model(). This method will return the currently active User model – the custom User model if one is specified, or User otherwise.

When you define a foreign key or many-to-many relations to the User model, you should specify the custom model using the AUTH_USER_MODEL setting. For example:

@lmorchard
Copy link
Contributor

Hmm, looks like this fails tests under Django 1.4, which we still need to support. Will need to take a look at how to stay backwards compatible

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants