On 2010-05-26, at 15:02 , Nuno Maltez wrote:
> 
> http://docs.djangoproject.com/en/dev/topics/http/sessions/#using-sessions-in-views
> 
> 
>>    if request.session.get('has_visited',True):
> 
> You're passing True as the default value to the get method  - get(key,
> default=None); this means that when 'has_visited' isn't set in your
> session (1st visit) it still returns True.
> 
> Just replace :
> 
>   if request.session.get('has_visited',True):
>       visited = True
>   else:
>       visited = False
> 
> with
> 
> visited = request.session.get('has_visited', False)
> 
> hth,
> Nuno


The `False` default isn't even mandatory.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to