AlexH
AlexH

Reputation: 327

django.contrib.auth.model.py missing BaseUserManager, AbstractBaseUser

I'm trying to make a custom user model as described in the django docs. It says to extend AbstractBaseUser and BaseUserManager to get started. However these are not defined in the auth model. I see it in the github respository, but not in my version. However, I have 1.4.2, which is the latest version. Why would these classes be missing from what I have?

I've tried to copy the files from github, but now I'm not sure where the django files are being taken from. After replacing the auth files, I got the same error (ImportError: cannot import name BaseUserManager). Even when I delete the auth directory, I get the same error. Is there any way to determine exactly which django files are being pulled?

Upvotes: 0

Views: 2639

Answers (1)

dokkaebi
dokkaebi

Reputation: 9190

The section you refer to is new in 1.5. Note the first line in this section: https://docs.djangoproject.com/en/dev/topics/auth/#customizing-the-user-model

They have a branch called stable/1.5.x that you could check out if you want to use the new functionality, but keep in mind it is still changing until it's released. It may be easier to stick with 1.4 and use a Profile model instead of subclassing User.

Upvotes: 2

Related Questions