Opened 12 years ago

Closed 12 years ago

#18939 closed Uncategorized (invalid)

usage of url template tag under-documented

Reported by: John D'Ambrosio Owned by: nobody
Component: Documentation Version: dev
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

Hello,
While learning about the {% url %} template tag, I found the documentation to be inadequate in one section and incorrect in another. Forums answered my question, but I just wanted to bring it to your attention. I have the snippets below.
Thanks, John

https://docs.djangoproject.com/en/dev/ref/templates/builtins/

Reads
If you're using named URL patterns, you can refer to the name of the pattern in the url tag instead of using the path to the view.

Recommend
If you're using named URL patterns, you can refer to the name of the pattern in the url tag without quotation marks instead of using the path to the view.

https://docs.djangoproject.com/en/dev/topics/http/urls

Reads
Here's the above example, rewritten to use named URL patterns:

urlpatterns = patterns(' ',

url(..., name="full-archive"),
url(..., "arch-summary"),

)

With these names in place (full-archive and arch-summary), you can target each pattern individually by using its name:

{% url 'arch-summary' 1945 %}
{% url 'full-archive' 2007 %}

Recommend
{% url arch-summary 1945 %}
{% url full-archive 2007 %}

Change History (1)

comment:1 by Aymeric Augustin, 12 years ago

Resolution: invalid
Status: newclosed

Thanks for the report, but the documentation is correct. See:

Version 0, edited 12 years ago by Aymeric Augustin (next)
Note: See TracTickets for help on using tickets.
Back to Top