Skip to content

Commit

Permalink
Fixed #13116 -- Described scope of variables created by {% url ... as…
Browse files Browse the repository at this point in the history
… var %} syntax.

Thanks leif_p for the suggestion.
  • Loading branch information
timgraham authored and akaariai committed Jan 18, 2014
1 parent f2f16f9 commit 83aa500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/ref/templates/builtins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1053,11 +1053,13 @@ cause your site to display an error page.
If you'd like to retrieve a URL without displaying it, you can use a slightly
different call::


{% url 'path.to.view' arg arg2 as the_url %}

<a href="{{ the_url }}">I'm linking to {{ the_url }}</a>

The scope of the variable created by the ``as var`` syntax is the
``{% block %}`` in which the ``{% url %}`` tag appears.

This ``{% url ... as var %}`` syntax will *not* cause an error if the view is
missing. In practice you'll use this to link to views that are optional::

Expand Down

0 comments on commit 83aa500

Please sign in to comment.