paularmstrong/swig — Issue #34: variable declared in {% for %} tag is not exposed via the context object
Author: elliotf
Created: 2012-01-19 22:05:14+00:00
State: open

Scenario:

Context obj:

{ people: [ { name: "bob", description: "a user" }] }

Outer file:

{% for person in people %}
{% include '/fragment/person.html' %}
{% endfor %}

Inner template:

{{ person.name }}

{{ person.description }}

The problem is that the "person" variable declared in the for loop is not exposed via the context object passed to the inner template.

How would you prefer this be solved, or do you have a suggested solution?

* Should the "for" tag be changed to have the inner context be populated with the possibly new variable?
* Should the "with" tag be implemented ( https://docs.djangoproject.com/en/dev/ref/templates/builtins/#with )?