Opened 12 years ago

Closed 12 years ago

#20110 closed Uncategorized (invalid)

Unnecessary single quotes in examples

Reported by: artem.skvira@… Owned by: nobody
Component: Documentation Version: 1.4
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

It looks like documentation for "url" template tag in here https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse-resolution-of-urls specifies that one should use single quotes around first argument, for example

{% url 'view.name' %}

Although when you do this, NoReverseMatch exception is thrown when parsing those URL tags. Removing the quotes seem to fix the problem.

Change History (1)

comment:1 by anonymous, 12 years ago

Resolution: invalid
Status: newclosed

Quotes are needed starting with 1.5, it seems you are reading the current development level documentation but using 1.4. There is a warning box at the bottom of the url template tag documentation (https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#url):

Don’t forget to put quotes around the function path or pattern name!

Changed in Django 1.5: The first parameter used not to be quoted, which was inconsistent with other template tags. Since Django 1.5, it is evaluated according to the usual rules: it can be a quoted string or a variable that will be looked up in the context.

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