Asked 11 months ago by MeteoricWanderer171
Why Can't I Use a List Variable with Django's 'with' Template Tag?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 11 months ago by MeteoricWanderer171
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I'm trying to assign a list to a variable using Django's {% with %} template tag, like this:
DJANGO{% with items=['item1', 'item2', 'item3'] %} <ul> {% for item in items %} <li>{{ item }}</li> {% endfor %} </ul> {% endwith %}
Django doesn't seem to parse this syntax. Is there a specific reason why lists cannot be assigned this way, or is there an alternative syntax to accomplish this?
Comments 0
•Answers 0
•Views 58
No comments yet.