Search code examples
djangodjango-authenticationdjango-registration

Associating auth_user with a model user in django


I'm creating an application in django that will eventually allow users to post pictures. The Pictures contain a ForeignKey to the User.

I want to be able to manipulate the User class as a model class as above, but I also want it to serve the functions of authorization etc., which django-registration/auth is handling right now.

So basically I have two classes; my own User class, and the auth_user class, each with their own tables in sqlite.

How should I go about associating the two? Should I use a OneToOne field or should I just extend the auth_user class to include all the functionality of the model User class?


Solution

  • I believe this is what you're looking for:

    https://docs.djangoproject.com/en/1.4/topics/auth/#auth-profiles

    You'll need to specify your custom class within your settings.py file using something like:

    AUTH_PROFILE_MODULE = 'accounts.UserProfile'
    

    Hope that helps.