I have 4 lists with the same length and would like to pass all of them to the html page.
views.py
return render(request, 'result.html', {'listA':listA, 'listB':listB, 'listC':listC, 'listD':listD})
And here is the code when I tried with Flask.
app.py
return render_template('result.html', listA = listA, listB = listB, listC = listC, listD = listD)
Below is the code in the template file; with Flask, it prints out the table without any problems, but it doesn't seem to work with Django. How should I fix my code?
result.html
{% for i in listA %}
<tr>
<th> {{ listA[loop.index] }} </th>
<td> {{ listB[loop.index] }} </td>
<td> {{ listC[loop.index] }} </td>
<td> {{ listD[loop.index] }} </td>
</tr>
{% endfor %}