I want to do the below list iteration in django templates:
foo = [\'foo\', \'bar\'];
moo = [\'moo\', \'loo\'];
for (a, b) in zip(foo, moo):
print a, b
<
I built django-multiforloop to solve this problem. From the README:
With django-multiforloop installed, rendering this template
{% for x in x_list; y in y_list %}
{{ x }}:{{ y }}
{% endfor %}
with this context
context = {
"x_list": ('one', 1, 'carrot'),
"y_list": ('two', 2, 'orange')
}
will output
one:two
1:2
carrot:orange