is there a way to loop over two lists simultaneously in django?

前端 未结 6 1215
小鲜肉
小鲜肉 2020-12-01 16:08

I have two list objects of the same length with complementary data i want to render is there a way to render both at the same time ie.

{% for i,j in table,          


        
6条回答
  •  渐次进展
    2020-12-01 16:49

    Rather than using a dictionary (which does not guarantee any kind of sorting), use the python zip function on the two lists and pass it to the template.

提交回复
热议问题