I got exactly the same problem, with the nearly the same code.
I used pdb and check that login(request, user) is well called.
But in the next view, in my template i do a {% user.is_authenticated
%},
and it seams that the user is not logged in.
Someone have an idee ? bug or wrong session configuration ?

Regards

Vincent

On Oct 6, 8:09 pm, Robocop <[EMAIL PROTECTED]> wrote:
> Having looked through the archived posts, i found a similar problem
> that had found no 
> solution:http://groups.google.com/group/django-users/browse_thread/thread/bf05...
>
> It looks like django is not actually logging my user in, or not
> creating a session.  I have a very simple snippet for login
> functionality pretty much lifted directly from the docs:
>
> from django.contrib.auth import logout, login, authenticate
>
> def login(request):
>   news_list = New.objects.all().order_by('-date')
>   if request.method == 'POST':
>     username = request.POST['username']
>     password = request.POST['password']
>     user = auth.authenticate(username=username, password=password)
>     if user is not None:
>           if user.is_active:
>             auth.login(request,user)
>           return render_to_response('main.html', locals())
>     else:
>       return render_to_response('registration.html', locals())
>
> settings.py:
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.sites',
>     'django.contrib.admin',
>     'intrinsic.site',
> )
>
> When i was running this project under .96 i never had this issue.
> It's as if the auth.login line is somehow failing silently.  I've
> tested and am absolutely sure that the code does everything it should
> but that one auth.login line.  So because of this i can't get at the
> {{user}} variable in my templates.  Any help, or suggestions for
> debugging attempts would be great.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to