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.
- Create a model object for UserProfile which will have django.contrib.auth.models..User as a FK
- Add the following to settings.py AUTH_PROFILE_MODULE = ‘accounts.UserProfile’
- 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 ?
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 defaultcontrib.auth.models.Userand a custom model (usually aUserProfile– although this could be anything). The alternative is to reverse the relationship yourself, something like: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) anddjango-registration(to add sign-up views)