Tuesday, October 23, 2012

[ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work

Django's standard User class isn't sufficient for my needs so I am making my own User class. As per the User Authentication doc page, I am subclassing AbstractUser (not AbstractBaseUser) to add some new stuff.

____
from django.contrib.auth.models import AbstractUser

class MyUser(AbstractUser):
        test = 'Hello world'
____

Pretty simple so far. In settings.py:
____
# Specifies SDBUser as the custom User class for Django to use
AUTH_USER_MODEL = 'app.MyUser'
____

But when i try to syncdb, everything breaks:

[root@Surya project]# manage syncdb
CommandError: One or more models did not validate:
app.userprofile: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
auth.user: Model has been swapped out for 'app.SDBUser' which has not been installed or is abstract.
django_openid_auth.useropenid: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.

django_openid_auth is a third party OpenID library, but the first two are pure Django and they're still breaking. Wat do?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/fLbSAxq1RysJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate