{% extends 'base/layout.html' %} {% load buttons %} {% load helpers %} {% load render_table from django_tables2 %} {% load static %} {% comment %} Blocks: extra_controls: Additional action buttons bulk_buttons: Additional bulk action buttons to display beneath the objects list Context: model: The model class being listed table: The table class used for rendering the list of objects actions: A list of buttons to display. This template checks for add, import, export, bulk_edit, and bulk_delete. filter_form: The bound filterset form for filtering the objects list (optional) return_url: Return URL to use for bulk actions (optional) {% endcomment %} {% block title %}{{ model|meta:"verbose_name_plural"|bettertitle }}{% endblock %} {% block controls %}
{% block extra_controls %}{% endblock %} {% if 'add' in actions %} {% add_button model|validated_viewname:"add" %} {% endif %} {% if 'import' in actions %} {% import_button model|validated_viewname:"import" %} {% endif %} {% if 'export' in actions %} {% export_button model|content_type %} {% endif %}
{% endblock controls %} {% block tabs %} {% endblock tabs %} {% block content-wrapper %}
{# Object list #}
{# Applied filters #} {% if filter_form %} {% applied_filters filter_form request.GET %} {% endif %} {# "Select all" form #} {% if table.paginator.num_pages > 1 %}
{% csrf_token %}
{% if 'bulk_edit' in actions %} {% endif %} {% if 'bulk_delete' in actions %} {% endif %}
{% endif %} {# Object table controls #} {% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}
{% csrf_token %} {# Object table #}
{% include 'htmx/table.html' %}
{# Form buttons #}
{% block bulk_buttons %} {% if 'bulk_edit' in actions %} {% endif %} {% if 'bulk_delete' in actions %} {% endif %} {% endblock %}
{# Filter form #} {% if filter_form %}
{% include 'inc/filter_list.html' %}
{% endif %}
{% endblock content-wrapper %} {% block modals %} {% table_config_form table table_name="ObjectTable" %} {% endblock modals %}