Login

Tag "groupby"

Snippet List

Group sequence into rows and columns for a TABLE

Two template tag filters that can be used to create a table from a sequence. <table> {% for row in object_list|groupby_columns:3 %} <tr> {% for obj in row %} <td>{{ obj }}</td> {% endfor %} </tr> {% endfor %} </table> The example above would create a table where items read from top to bottom, left to right, in 3 columns. "Empty" cells are added to the sequence by the filter so that your rows balance.

  • filter
  • templatetag
  • table
  • groupby
Read More

1 snippet posted so far.