Parag
Parag

Reputation: 12453

What exactly does Django UserProfile give me?

I was reading about Django's support for custom user profiles. I understand that if I do the following steps, I will be able to tie in a custom user profile object with my application.

  1. Create a model object for UserProfile which will have django.contrib.auth.models..User as a FK
  2. Add the following to settings.py AUTH_PROFILE_MODULE = 'accounts.UserProfile'
  3. Ensure that a UserProfile object is available for every User object (either using django signals, or creating one when it is queried)

By doing all this what I get is the ability to obtain a user profile by doing

user.get_profile()

My question is, is there any other functionality I get, such as (non admin) views to view/edit the user profile ?

Upvotes: 0

Views: 258

Answers (2)

Timmy O'Mahony
Timmy O'Mahony

Reputation: 53998

There is no added functionality at all. The only thing Django is doing is providing a simple way (via get_profile) to reverse the relationship between django's default contrib.auth.models.User and a custom model (usually a UserProfile - although this could be anything). The alternative is to reverse the relationship yourself, something like:

my_user.userprofile_set.all()[0]

which is obviously inconvenient.

If you want added functionality, you need to look at something like django-profiles (to add the views for editing a profile) and django-registration (to add sign-up views)

Upvotes: 1

szaman
szaman

Reputation: 6756

User profile allow you only to extend standard user model. You don`t get any additional functionality.

Upvotes: 1

Related Questions