Reputation: 16506
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
Upvotes: 3
Views: 1976
Reputation: 5599
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.
Upvotes: 4