Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. def Logins(request):
  2. if request.method == 'POST':
  3. username = request.POST['username']
  4. password = request.POST['password']
  5. user = authenticate(username=username, password=password)
  6. if user is not None and user.is_active:
  7. login(request, user)
  8. return HttpResponseRedirect('music/login')
  9. return HttpResponseRedirect('music/login')
  10. form = Userlogin
  11. return render(request, 'music/login.html', {'Login_form': Userlogin})
  12.  
  13. [It shows MultiValueDictKeyError at /music/login/.][1]
  14.  
  15. {% block body %}
  16. {% if form.errors %}
  17. <p>Something is wrong</p>
  18. {% endif %}
  19.  
  20. <form action="" method="post">
  21. {% csrf_token %}
  22. <label for="email">Login:</label>
  23. <label for="password">Password:</label>
  24. <input type="password" name="password" value="" id="username">
  25.  
  26. <input type="submit" value="login" />
  27.  
  28. </form>
  29. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement