Scipion
Scipion

Reputation: 11888

Django (1.4) how to use with template tag to assign several variables

I am trying to assign several variables in the same with :

{% with 'Foo' as description 'Blah' as description_2 %}
...
{% endwith %}

Is there any way to achieve this ? (It works with two with)

Upvotes: 0

Views: 211

Answers (1)

knbk
knbk

Reputation: 53669

Assigning multiple variables is possible with the new syntax:

{% with description='Foo' description_2='Blah' %}
...
{% endwith %}

See https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#with.

Upvotes: 4

Related Questions