On Thu, Oct 9, 2008 at 5:18 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...
>

I get a 'topic not found' error from Google Groups when I click on either
the link in my email copy of this post or the link in the post at Google
Groups.  So I cannot refer to the older similar problem to try to understand
what's going on.


>
> 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:
>            login(request,user)
>          return HttpResponseRedirect('/')
>    else:
>      return render_to_response('registration.html', locals())
>

You import login from django.contrib.auth but then you redefine login, which
means when you call login from within login you should recursively call the
function you are already in...but apparently that is not happening?  You
also import 'authenticate' but call 'auth.authenticate', so I am suspicious
that the code you have posted is not really the code you are running, which
makes it rather hard to speculate on what might be going wrong.

Karen

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