[Django]-No Reverse Match with Django Auth Views

10๐Ÿ‘

โœ…

{% url 'django.contrib.auth.views.login' %}

This is incorrect. We put the name given to the url here instead of the location of the view.

Please see https://docs.djangoproject.com/en/1.10/ref/templates/builtins/#url. You need to provide a name for login like you have for home and then use that.

Correct way is:
urls.py ->

url(r'^accounts/login/$', auth_views.login, {'template_name': 'login.html','authentication_form': LoginForm}, name="login") ,

template ->

<form method="post" action="{% url 'login' %}">
๐Ÿ‘คSwakeert Jain

Leave a comment