Opened 4 years ago

Closed 4 years ago

#16118 closed Uncategorized (invalid)

Small error in login form example

Reported by: yuval.baror@… 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:


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:

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 Changed 4 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by kmtracey

  • Resolution set to invalid
  • Status changed from new to 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.

Note: See TracTickets for help on using tickets.
Back to Top