Also move :
  request.session['has_visited'] = True
above the return statement.

On May 26, 4:02 pm, Nuno Maltez <nuno.li...@gmail.com> wrote:
> http://docs.djangoproject.com/en/dev/topics/http/sessions/#using-sess...
>
> >    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

-- 
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