#18939: usage of url template tag under-documented -------------------------------+-------------------- Reporter: jdzero | Owner: nobody Type: Uncategorized | Status: new Component: Documentation | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- 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 %} -- Ticket URL: <https://code.djangoproject.com/ticket/18939> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.