On Sat, Dec 6, 2008 at 2:42 PM, vierda <[EMAIL PROTECTED]> wrote:
> today I try to make login page with follow example code in
> djangoproject (user authentication chapter), code as following below :
>
> def my_view(request):
> username = request.POST['username']
> password = request.POST['password']
> user = authenticate(username=username, password=password)#create
> Authentication object
>
> if user is not None:
> if user.is_active:
> login(request,user)
> return HttpResponse('login success')
> else:
> return HttpResponse('disable account')
> else:
> return HttpResponse('invalid login')
>
> the above code always shows MultiValueDictKeyError with exception
> value "Key 'username' not found in <QueryDict: {}>".
That exception will always be raised if the view is called via GET
method instead of POST.
If you're sending it via POST, then the information you provided was
not sufficient. We need to see template code that renders the form (or
the html form if you're not using templates) and probably the form as
well.
Ronny
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---