[Django]-Django 1.4 Creating an Edit User Profile Account Settings View

6πŸ‘

βœ…

To get the profile attached to a user object, you just need to call get_profile() on the user object:

user.get_profile()

For example,

request.user.get_profile()

The docs on it are in Django Docs. Its worth noting that

The method get_profile() does not create a profile if one does not exist.

So you have to have a trigger to create profiles on creating users …

πŸ‘€jvc26

0πŸ‘

user.get_profile() is now depreciated, instead, assuming you have a OneToOne with the user model, you can just use user.profile

πŸ‘€Reed Jones

Leave a comment