Questions about how Django handles user authentication.

31 views
Skip to first unread message

Chen Xu

unread,
Jan 20, 2014, 12:35:40 AM1/20/14
to django...@googlegroups.com
Hi Everyone,
I am wondering how request.User get set during the authentication, do we have to do anything like:

request.User = User(....) or it will have value by itself?


Thanks in advance.
--
⚡ Chen Xu

Avraham Serour

unread,
Jan 20, 2014, 5:42:00 AM1/20/14
to django...@googlegroups.com
on your view the request object will be populated already, it is meant for read only, including the user object so you could check for example if the current user is authenticated using the request.user object

good luck


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACac-qZDa9GrT1wjbBxBsSR%2BGmotScqS76VrTCVw-8TJRioa7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Daniel Roseman

unread,
Jan 20, 2014, 6:10:10 AM1/20/14
to django...@googlegroups.com
Did you try reading the documentation, which explains all this fully?

request.user (note lower case) is populated by the authentication middleware.
--
DR. 
Reply all
Reply to author
Forward
0 new messages