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
- [Django]-JSON decode error while sending post request during testing
- [Django]-ImportError: No module named south
- [Django]-Import error: No module named 'Crypto' on Mac (Pycrypto is up-to-date)
Source:stackexchange.com