{% load django_tables2 %} {% load i18n l10n mvp %} {% block table-wrapper %} {% block table %} {% row_header_columns table as row_headers %} {% block table.thead %} {% if table.show_header %} {% for column in table.columns %} {% endfor %} {% endif %} {% endblock table.thead %} {% block table.tbody %} {% comment %} Meta.row_headers columns get th scope="row" cells (#320). Content is written under both branches, not shared, since rendering a variable applies locale/timezone formatting a tag return would not. {% endcomment %} {% for row in table.paginated_rows %} {% block table.tbody.row %} {% for column, cell in row.items %} {% if column.name in row_headers %} {% else %} {% endif %} {% endfor %} {% endblock table.tbody.row %} {% endfor %} {% comment %} One last row takes whatever height the rows above leave, so the footer row sits at the bottom of the region however few rows there are. With no rows at all it holds the empty state, which needs the page's own context: this template is rendered with the table alone, and the page's context hangs off it. {% endcomment %} {% endblock table.tbody %} {% block table.tfoot %} {% if table.has_footer %} {% for column in table.columns %} {% if column.name in row_headers %} {% else %} {% endif %} {% endfor %} {% endif %} {% endblock table.tfoot %}
{% comment %} A falsey heading prints nothing rather than the value (#319); the cell and its sort control stay — suppressing the heading is not a request to drop ordering too. {% endcomment %} {% if column.orderable %} {{ column.header|default:"" }} {% else %} {{ column.header|default:"" }} {% endif %}
{% if column.localize == None %} {{ cell }} {% else %} {% if column.localize %} {{ cell|localize }} {% else %} {{ cell|unlocalize }} {% endif %} {% endif %} {% if column.localize == None %} {{ cell }} {% else %} {% if column.localize %} {{ cell|localize }} {% else %} {{ cell|unlocalize }} {% endif %} {% endif %}
{{ column.footer }}{{ column.footer }}
{% endblock table %} {% endblock table-wrapper %}