views:

46

answers:

1

I'm getting started with django and I'd like to extend the basic django.contrib.auth.models.User class to create my own site profile(s). Here is described how to do it, got that.

As far as I've understood it, you can only specify a single class as AUTH_PROFILE_MODULE in your settings.py.

Now, if I create an extension class of my profile class like this

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    somefield = models.CharField()

class UserProfileExtended(UserProfile):
    extrafield = models.CharField()

then I cannot make both of them profile classes, right?

(I know, in this case you'd just add the extrafield to the superclass and drop the UserProfileExtended entirely. Just imagine you have so many fields in UserProfileExtended that you really want to split them up)

Thanks for your help!

+1  A: 

There can be only one profile class. I guess I don't understand the scenario where you would want to split them up. In any case,

AUTH_PROFILE_MODULE = "UserProfileExtended"

should handle the inheritance correctly for the simple example you give.

Michael Greene