Have a list called whatever that I want to itemize in Jinja:
<ol>
{% for item in whatever %}
<tr>
<td>
<li> {{ item }}</li>
</td>
</tr>
{% endfor %}
</ol>
However, when I implement this in this way, I get unordered list output rather than sequential numbers, i.e.
rather than
It is actually a problem with your html (and not python / jinja). It you remove the tr/td tags it will be ok.
Update: If you insist on using the table tags, drop the ol/li tags, and use the loop object that is implicitly defined in the jinja for loop. That is,
<td>{{loop.index}}. {{item}}</td>
will give you enumerated item.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With