From 4a5aac47a619a27c2458cfdcba56d53b05c789ad Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 17 Jan 2014 14:50:47 -0500 Subject: [PATCH] Fixed #13116 -- Described scope of variables created by {% url ... as var %} syntax. Thanks leif_p for the suggestion. --- docs/ref/templates/builtins.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index e5c6efcf865..ecd39f1adce 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -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 %} I'm linking to {{ the_url }} +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::