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
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
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
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
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
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
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_
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
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
>
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
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
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
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
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
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
{% 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
16 matches
Mail list logo