Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the new approach to get user profile in Django 1.6?

Tags:

python

django

I'm quite new to Django. I'm trying to get user profile with the help of request.user.get_profile() but there is a warning that the use of AUTH_PROFILE_MODULE has been deprecated.

I have a line in my settings.py: AUTH_PROFILE_MODULE = "log_viewer.Configs" where Configs is a model with fields to keep user profile settings.

What is the new approach of doing this?

like image 892
vwvolodya Avatar asked Jan 29 '14 12:01

vwvolodya


1 Answers

At first,I create a 'profile' for User:

User.profile = property(lambda u: Configs.objects.get_or_create(user=u)[0])

and use this to get the profile:

request.user.profile

more detail here: https://code.djangoproject.com/ticket/15937

like image 178
Daniel Qiu Avatar answered Sep 23 '22 09:09

Daniel Qiu