Reputation: 43
I need to simplify this Django template,
{{ var.1 }}
{{ var.2 }}
{{ var.3 }}
{{ var.4 }}
{{ var.5 }}
var is Python list passed as context to the template
how do you convert the above template using a for tag construct. I tried this but does not work.
{% for i in var|length %}
{{ var.i }}
{% endfor %}
Upvotes: 1
Views: 2898