Code

Opened 4 years ago

Closed 3 months ago

Last modified 3 months 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.

Attachments (0)

Change History (7)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by lukeplant

  • Type set to New feature

comment:3 Changed 3 years ago by lukeplant

  • Severity set to Normal

comment:4 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 3 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 4a5aac47a619a27c2458cfdcba56d53b05c789ad:

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

Thanks leif_p for the suggestion.

comment:7 Changed 3 months ago by Tim Graham <timograham@…>

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.