If you want to store extra information about a user (django.contrib.auth.models.User) in Django you can use the nifty AUTH_PROFILE_MODULE to plug in a “profile” model. Each user then gets a profile. It’s all described here:
- http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
- http://www.djangobook.com/en/1.0/chapter12/#cn222
Now, let’s say I have created an application called accounts with a model called UserProfile and registered it as the profile model for my users. How do I inline the editing of the profile in the admin interface for editing users (or vice versa)?
Well, it turns out that this is quite easy, once you know how to do it. This is my myapp/accounts/admin.py:
The default
admin.UserAdminModelAdmin class for users is unregistered and a new one specifying an inlineUserProfileis registered in its place. Just thought I should share.