Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
I don't know what is happening but I've solved with a workaround: dummy = self.request.user.is_authenticated() calling is_authenticated before returning render_to_response solves the problem, because request.user is "casted" to the actual user instance, instead of remaining a SimpleLazyObje

Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
The problem seems to be related with SimpleLazyObject, wrapping the auth.user. If during debugging I access the function, everything works fine. It's enough to have the Variables windows open in PyDev. If I do not access it, it isn't resolved to the actual user instance (in my case AnonymousUser

call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
return HttpResponseRedirect(self.group.get_absolute_url()) (...) Passing the RequestContext instance causes a DatabaseError, raised when it tries to test the user.is_authenticated template context variable. I've noticed that when used in a basic view method, the resolution of us

Re: RequestContext and user.is_authenticated confusion

2010-02-14 Thread Kev Dwyer
On Sun, 14 Feb 2010 08:30:05 -0800, Achim Domma wrote: > Hi Kev, > > thanks for the hint. Trying different solutions I introduced indeed a > typo. Now I can see the username and is_authenticated works as expected. > But still curious: Is there a good reason, why I have to pass > RequestContext ea

Re: RequestContext and user.is_authenticated confusion

2010-02-14 Thread Achim Domma
Hi Kev, thanks for the hint. Trying different solutions I introduced indeed a typo. Now I can see the username and is_authenticated works as expected. But still curious: Is there a good reason, why I have to pass RequestContext each time? Whenever I'm using Django and having the feeling to violate

Re: RequestContext and user.is_authenticated confusion

2010-02-14 Thread andreas schmid
Kev Dwyer wrote: > On Sun, 14 Feb 2010 01:19:41 -0800, Achim Domma wrote: > > >> Hi, >> >> depending on if a user is logged in or not, I want to display a "login" >> form or a "logout" button. I tried to use this code snippet: >> >> http://docs.djangoproject.com/en/1.1/topics/auth/#id6 >> >> If

Re: RequestContext and user.is_authenticated confusion

2010-02-14 Thread Kev Dwyer
On Sun, 14 Feb 2010 01:19:41 -0800, Achim Domma wrote: > Hi, > > depending on if a user is logged in or not, I want to display a "login" > form or a "logout" button. I tried to use this code snippet: > > http://docs.djangoproject.com/en/1.1/topics/auth/#id6 > > If I render my view using render_

RequestContext and user.is_authenticated confusion

2010-02-14 Thread Achim Domma
Hi, depending on if a user is logged in or not, I want to display a "login" form or a "logout" button. I tried to use this code snippet: http://docs.djangoproject.com/en/1.1/topics/auth/#id6 If I render my view using render_to_response("myTemplate.html") the user variable is empty. If I use rend

Re: user.is_authenticated

2009-06-02 Thread Jarek Zgoda
uth method instead of render_to_response, which > automatically > adds the RequestContext to all of my templates. > > Tim. > > On Monday 01 June 2009 17:40:53 K.Berkhout wrote: >> Hi, >> >> Is there a way I can access the "user.is_authenticated" method in >

Re: user.is_authenticated

2009-06-01 Thread K.Berkhout
e variables from the default contexts plus > the ones you include in the dictionary... the auth context is loaded by > default (if i remember correctly)... > > hope it helps, > > g > > 2009/6/1 K.Berkhout > > > > > > > Hi, > > > Is there a

Re: user.is_authenticated

2009-06-01 Thread Genis Pujol Hamelink
tml", variables) In variables you will have all the variables from the default contexts plus the ones you include in the dictionary... the auth context is loaded by default (if i remember correctly)... hope it helps, g 2009/6/1 K.Berkhout > > Hi, > > Is there a way I can access

Re: user.is_authenticated

2009-06-01 Thread Tim Sawyer
Monday 01 June 2009 17:40:53 K.Berkhout wrote: > Hi, > > Is there a way I can access the "user.is_authenticated" method in > every view, without having to manually pass the User model to every > template? Basicly I want to show a login or logout link on every page, > depend

Re: user.is_authenticated

2009-06-01 Thread Masklinn
On 1 juin 09, at 18:40, "K.Berkhout" wrote: > Hi, > > Is there a way I can access the "user.is_authenticated" method in > every view, without having to manually pass the User model to every > template? Basicly I want to show a login or logout link on every page

user.is_authenticated

2009-06-01 Thread K.Berkhout
Hi, Is there a way I can access the "user.is_authenticated" method in every view, without having to manually pass the User model to every template? Basicly I want to show a login or logout link on every page, depending on wether the visitor is logged in or not. I've included t

Re: user.is_authenticated is always false using default login

2008-05-20 Thread James Bennett
On Tue, May 20, 2008 at 10:32 AM, Andrew English <[EMAIL PROTECTED]> wrote: > Do I need to explicitly call authenticate and login in my own view to > populate the user data? From what I read, it seems that the > django.contrib.auth.views.login does that automatically. There's a difference betwee

user.is_authenticated is always false using default login

2008-05-20 Thread Andrew English
{% extends "base.html" %} {% block content %} {% if form.has_errors %} Your username and password didn't match. Please try again. {% endif %} Username:{{ form.username }} Password:{{ form.password }} {% endblock %} When the user logins in with correct credentials, they ar