I am struggling to format my list as a table in html (I am using django). Usually, I can easily achieve this by a for loop, like this:
<tbody>
{% for item in lyrics %}
<tr>
<td>{{lyrics}}</td>
</tr>
{% endfor %}
But this gives me the whole list in every table cell.
If I do it like this...
<tr>
<td>{{lyrics.0}}</td>
<td>{{lyrics.1}}</td>
</tr>
...it works. But obviously I don't want to write it out for all n items.
I was hoping I can do something like...
{% for i in lyrics.i % }
{{lyrics.i}}
But that didn't work either.
The following works in terms of getting the results neatly below each other, but obviously it's not a table:
<ol class='lyrics-list'>
{{ lyrics|unordered_list }}
</ol>
My list comes from my view:
lyrics = models.Song.objects.get().lyrics_as_list()