Guest User

Untitled

a guest
May 4th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. ## The View
  2.  
  3. def index(request):
  4. username = request.POST['username']
  5. password = request.POST['password']
  6. user = authenticate(username=username, password=password)
  7. if user is not None:
  8. if user.is_active:
  9. login(request, user)
  10. return HttpResponseRedirect('/home/')
  11. else:
  12. return HttpResponseRedirect('/disabled/')
  13. else:
  14. return HttpResponseRedirect('/invalid/')
  15.  
  16. ## The Error
  17. MultiValueDictKeyError at /
  18. "Key 'username' not found in <QueryDict: {}>"
Add Comment
Please, Sign In to add comment