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 <
Simply define zip as a template filter:
@register.filter(name='zip') def zip_lists(a, b): return zip(a, b)
Then, in your template:
{%for a, b in first_list|zip:second_list %} {{a}} {{b}} {%endfor%}