{# Render an HTMX-enabled table with paginator #} {% load helpers %} {% load buttons %} {% load render_table from django_tables2 %}
{% with preferences|get_key:"pagination.placement" as paginator_placement %} {% if paginator_placement == 'top' or paginator_placement == 'both' %} {% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page placement='top' %} {% endif %} {% render_table table 'inc/table_htmx.html' %} {% if paginator_placement != 'top' %} {% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page %} {% endif %} {% endwith %}
{% if request.htmx %} {# Include the updated object count for display elsewhere on the page #}
{{ table.rows|length }}
{# Update the bulk action buttons with new query parameters #} {% if actions %}
{% if 'bulk_edit' in actions %} {% bulk_edit_button model query_params=request.GET %} {% endif %} {% if 'bulk_delete' in actions %} {% bulk_delete_button model query_params=request.GET %} {% endif %}
{% endif %} {% endif %}