{% load querystring from django_tables2 %} {% load get_item table_config_button from helpers %} {% with last_column_name=table.columns.names|last %} {% 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 %} 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 }} {% if column.is_ordered %} {% if column.order_by_alias.is_ascending %} {% else %} {% endif %} {% 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 %}