I'm trying to display the items from two lists. This is my code:
#Django view.py file
def display(request):
listone = ['duck', 'chicken', 'cat', 'dog']
lents = len(list_one)
listtwo = ['4 dollars', '3 dollars', '2 dollars', '1 dollars']
return render(request, 'display.html', {'itemone' : listone, 'itemtwo' : listtwo, 'lents' : lents})
This is the display.html template that displays the lists:
<table>
<tr>
<th>Pet</th>
<th>Price</th>
</tr>
{% for numbers in lents %}
<tr>
<td>{{ itemone.numbers }}</td>
<td>{{ itemtwo.numbers }}</td>
</tr>
{% endfor %}
</table>
but with no luck it won't show the result according to the index 'numbers' which suppose to be from '0' to '3', the td
tags remaining empty.