{% load querystring_replace from django_tables2 %} {% load get_item table_config_button from helpers %} {% with last_column_name=table.visible_columns|last visible_column_count=table.visible_columns|length %} {% firstof table_caption table.data.verbose_name_plural "Table" %} {% if table.show_header %} {% for column in table.columns %} {% if not table.configurable or not forloop.last or last_column_name != 'actions' %} {% if column.orderable %} {% spaceless %} {% comment %} `aria-sort` conveys the current sort state of the column to assistive technology. It must appear on at most one column at a time, so unsorted columns are explicitly reported as `"none"`. {% endcomment %} {% comment %} Tri-state sorting toggle: unsorted → ascending → descending → unsorted {% endcomment %} {% if column.order_by_alias.is_ascending or not column.is_ordered %} {% else %} {% endif %} {{ column.header }} {% comment %} The sort direction arrow is decorative -- it duplicates information that `aria-sort` above already exposes -- so hide it from assistive technology and describe the action of the link in text instead. {% endcomment %} {% if column.is_ordered %} {% if column.order_by_alias.is_ascending %} activate to sort descending {% else %} activate to remove sorting {% endif %} {% else %} activate to sort ascending {% endif %} {% endspaceless %} {% else %} {{ column.header }} {% endif %} {% else %} {% table_config_button table %} {% endif %} {% endfor %} {% if table.configurable and last_column_name != 'actions' %} {% table_config_button table %} {% endif %} {% endif %} {% for row in table.page.object_list|default:table.rows %} {% for column, cell in row.items %} {{ cell }} {% endfor %} {% if table.configurable and last_column_name != "actions" %} {% endif %} {% empty %} {% if table.empty_text %} — {{ table.empty_text }} — {% endif %} {% endfor %} {% if table.has_footer %} {% for column in table.columns %} {{ column.footer }} {% endfor %} {% if table.configurable and last_column_name != "actions" %} {% endif %} {% endif %} {% endwith %}