Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#13116 closed New feature (fixed)

Specify in docs that template variables created e.g. by {%url%} are block-local

Reported by: leif_p Owned by: nobody
Component: Documentation Version: 1.1
Severity: Normal Keywords: template, variables, scoping
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi. {% url view_name as var %} seems to create a var whose scope is the block where the tag was called. This is not evident from the documentation, and took me a little while to figure out.

I assume this is the behavior of any other templatetag that lets you create a variable. Maybe you could add a section about scoping in the template system, and then have a link to it from the docs for each templatetag.

I am using Django 1.1 on Google App Engine, if that makes a difference.

Change History (7)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Luke Plant, 13 years ago

Type: New feature

comment:3 by Luke Plant, 13 years ago

Severity: Normal

comment:4 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 4a5aac47a619a27c2458cfdcba56d53b05c789ad:

Fixed #13116 -- Described scope of variables created by {% url ... as var %} syntax.

Thanks leif_p for the suggestion.

comment:7 by Tim Graham <timograham@…>, 11 years ago

In 4f058655d0defad179f1a92c7e2d1f282c26b1f0:

[1.6.x] Fixed #13116 -- Described scope of variables created by {% url ... as var %} syntax.

Thanks leif_p for the suggestion.

Backport of 4a5aac47a6 from master

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