Render a given instance of collections.Counter into a 2 column html table.
Optionally accepts `column_title` keyword argument which sets the table
key column header.
Usage:
{% counter_table event_counter column_title='event type' %}
The above will render the a table from the `event_counter` variable with the first (key) column set to "event type".
See below for an example template (i.e `counter_table.html`)
{% load i18n %}
<table>
<thead>
<tr>
<th>{{column_title|capfirst}}</th>
<th>{% trans "count"|capfirst %}</th>
</tr>
</thead>
<tbody>
{% for key, count in most_common %}
<tr>
<td>{{key}}</td>
<td>{{count}}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td>{% trans "total"|capfirst %}</td>
<td>{{total_count}}</td>
</tr>
</tfoot>
</table>
- html
- table
- inclusion-tag
- collections.Counter
- Counter