{% 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 %} {# The swap sits on the heading row alone, so htmx a project puts in a cell never inherits it. #} {# The filter panel is refreshed out of band (docs/adr/0034-what-sits-beside-the-list-region-is-refreshed-out-of-band.md). #} {% with region=table.context.list_region_id panel=table.context.filter_panel_id %} {% for column in table.columns %} {% endfor %} {% endwith %} {% 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 context rendered it in hangs off it, carrying the values that component was passed. {% 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 %}