Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month 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.

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?

0

Comments 0

Answers 0

Views 48

0 Answers

Discussion

No comments yet.