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 <
You can use zip in your view:
zip
mylist = zip(list1, list2) context = { 'mylist': mylist, } return render(request, 'template.html', context)
and in your template use
{% for item1, item2 in mylist %}
to iterate through both lists.
This should work with all version of Django.