Alper,
Do you have sessions enabled?  see
http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requestsfor
details.
As you are not doing anything special with your login function, have you
considered using the @login_required decorator on the dashboard view?  I
know that some people have an aversion to decorators, but this may simplify
things.
-richard


On 9/28/07, Alper Çuğun <[EMAIL PROTECTED]> wrote:
>
>
>
> Hey,
>
> Two simple view functions
>
> def user_login_validate(request):
>         username = request.POST['username']
>         password = request.POST['password']
>
>         user = authenticate(username=username, password=password)
>
>         if user is not None:
>                 if user.is_active:
>                         login(request, user)
>                         return HttpResponseRedirect('/dashboard/')
>
>         return HttpResponseRedirect('/login/fail/')
>
> This redirects to /dashboard/ as you would expect. Dashboard looks
> like this:
>
> def dashboard(request):
>         print request.user.is_authenticated()
>
>         print 'dashboard user', request.user
>
>         if request.user.is_authenticated():
>                 person =
> Person.objects.get(username=request.user.username)
>                 payOuts =
> Paid.objects.filter(link__payableTo=person.id, paid=True,
> paidOut=False).order_by('-paidDate')[:5]
>
>                 t = loader.get_template("passa/dashboard.html")
>                 c = Context({
>                         'username': request.user.username,
>                         'saldo': cashableMoney(request.user.username),
>                         'payOuts': payOuts
>                 })
>
>                 return HttpResponse(t.render(c))
>
> The problem is that request.user is AnonymousUser and that means my
> code never hits the inside block. I thought I had already
> authenticated in the previous function and login() had put my user
> into the request. It seems it hasn't. What's going wrong?
>
> I /am/ logged in because a refresh of the /dashboard/ does work, just
> this first time in does not.
>
> Thanks,
> --
> Alper Çugun
>
> Mobile: +31-6-24553306 * E-mail: [EMAIL PROTECTED]
> See my webpage and blogs at: http://www.alper.nl
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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