Opened 13 years ago
Closed 13 years ago
#16118 closed Uncategorized (invalid)
Small error in login form example
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The login form example contains the following line:
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
When I tried using this I got an error:
NoReverseMatch while rendering: Reverse for django.contrib.auth.views.login
After searching online I saw an answer on stackoverflow:
http://stackoverflow.com/questions/4578685/noreversematch-while-rendering-reverse-for-django-contrib-auth-views-login
The solution suggested there (removing the single quotes around the url) worked for me.
Perhaps it would be best to update the example to prevent others from encountering the same error.
Change History (2)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
That syntax for the url tag is new with 1.3, the need for the new syntax is apparent in the referenced doc by the inclusion of:
{% load url from future %}
in the full example. So if you are actually running 1.3 I'm guessing you did not include that load tag in your template. You'd also see the same error if you are running an earlier version of Django.
The documentation with the error is here:
https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login