Hi

I'm having trouble when using the AuthenticationForm in Django. It
tells me that I haven't enabled cookies, even though I'm completely
sure that I have. I get this error:

"Your Web browser doesn't appear to have cookies enabled. Cookies are
required for logging in."

I've tried restarting Django, the browser, tried several different
browsers, etc. I'm completely lost. I read somewhere that the login
view has to be called with a GET request before it's called with a
POST for this to work, but it *is* called with a GET to actually view
the login form in the first place.

Below is the login view that I'm using.

---------------------------------

def user_login(request):

    if request.user.is_authenticated():
        return HttpResponseRedirect('/main/')

    if request.method == 'POST':
        form = AuthenticationForm(request.POST)
        if form.is_valid():
            login(request, form.get_user())
            return HttpResponseRedirect('/main/')
        else:
            return render_to_response('login.html', { 'form' : form })

    else:
        form = AuthenticationForm()
        return render_to_response('login.html', { 'form' : form })

---------------------------------

Thanks,
Deniz
--~--~---------~--~----~------------~-------~--~----~
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 
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