Saturday 15 June 2013

django - Looping over two lists in a template -



django - Looping over two lists in a template -

in django template, want access elements in 1 list, whilst looping on elements in list. so, pass lists mylist1 , mylist2 (both have same number of elements) template context variables, , want loop through mylist1, display element, , display corresponding element of mylist2. this:

{% result in mylist1 %} <p>result</p> <p>{{ mylist2.forloop.counter }}</p> {% endfor %}

what's right solution?

django

No comments:

Post a Comment