2021-05-17 16:27:27 -04:00
|
|
|
{% extends 'base/layout.html' %}
|
2020-02-13 13:13:27 -05:00
|
|
|
{% load buttons %}
|
|
|
|
{% load helpers %}
|
2022-11-14 10:51:58 -08:00
|
|
|
{% load plugins %}
|
2021-04-05 17:13:32 -04:00
|
|
|
{% load render_table from django_tables2 %}
|
2020-10-21 14:52:50 -04:00
|
|
|
{% load static %}
|
2023-07-29 03:30:25 +07:00
|
|
|
{% load i18n %}
|
2020-02-13 13:13:27 -05:00
|
|
|
|
2022-02-07 16:50:17 -05:00
|
|
|
{% 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
|
2022-02-24 16:33:51 -05:00
|
|
|
actions: A list of buttons to display. This template checks for add, import,
|
|
|
|
export, bulk_edit, and bulk_delete.
|
2022-02-07 16:50:17 -05:00
|
|
|
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 %}
|
2021-10-05 15:21:49 -04:00
|
|
|
|
2021-03-13 02:19:42 -07:00
|
|
|
{% block controls %}
|
2021-08-06 15:35:14 -04:00
|
|
|
<div class="controls">
|
|
|
|
<div class="control-group">
|
2022-11-14 10:51:58 -08:00
|
|
|
{% plugin_list_buttons model %}
|
2021-08-06 15:35:14 -04:00
|
|
|
{% block extra_controls %}{% endblock %}
|
2022-03-02 16:13:59 -05:00
|
|
|
{% if 'add' in actions %}
|
2023-01-26 10:53:59 -05:00
|
|
|
{% add_button model %}
|
2021-08-06 15:35:14 -04:00
|
|
|
{% endif %}
|
2022-03-02 16:13:59 -05:00
|
|
|
{% if 'import' in actions %}
|
2023-01-26 10:53:59 -05:00
|
|
|
{% import_button model %}
|
2021-08-06 15:35:14 -04:00
|
|
|
{% endif %}
|
2022-02-24 16:33:51 -05:00
|
|
|
{% if 'export' in actions %}
|
2023-01-26 10:53:59 -05:00
|
|
|
{% export_button model %}
|
2021-08-06 15:35:14 -04:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2021-03-13 02:19:42 -07:00
|
|
|
</div>
|
2021-05-17 16:27:27 -04:00
|
|
|
{% endblock controls %}
|
2021-03-13 02:19:42 -07:00
|
|
|
|
2021-08-06 15:35:14 -04:00
|
|
|
{% block tabs %}
|
|
|
|
<ul class="nav nav-tabs px-3">
|
2022-02-07 16:50:17 -05:00
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
2023-07-29 03:30:25 +07:00
|
|
|
{% trans "Results" %} {% badge table.page.paginator.count %}
|
2022-02-07 16:50:17 -05:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
{% if filter_form %}
|
2021-08-06 15:35:14 -04:00
|
|
|
<li class="nav-item" role="presentation">
|
2022-02-07 16:50:17 -05:00
|
|
|
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
2023-07-29 03:30:25 +07:00
|
|
|
{% trans "Filters" %}
|
2022-02-11 14:25:13 -05:00
|
|
|
{% if filter_form %}{% badge filter_form.changed_data|length bg_color="primary" %}{% endif %}
|
2021-08-06 15:35:14 -04:00
|
|
|
</button>
|
|
|
|
</li>
|
2022-02-07 16:50:17 -05:00
|
|
|
{% endif %}
|
2021-08-06 15:35:14 -04:00
|
|
|
</ul>
|
|
|
|
{% endblock tabs %}
|
|
|
|
|
|
|
|
{% block content-wrapper %}
|
|
|
|
<div class="tab-content">
|
2021-07-10 22:06:28 -04:00
|
|
|
|
2021-08-06 15:35:14 -04:00
|
|
|
{# Object list #}
|
|
|
|
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
|
2021-08-01 21:24:22 -07:00
|
|
|
|
2021-08-10 13:04:50 -04:00
|
|
|
{# Applied filters #}
|
|
|
|
{% if filter_form %}
|
2022-11-02 12:27:53 -04:00
|
|
|
{% applied_filters model filter_form request.GET %}
|
2021-08-10 13:04:50 -04:00
|
|
|
{% endif %}
|
|
|
|
|
2022-12-14 11:58:44 -08:00
|
|
|
{# Object table controls #}
|
|
|
|
{% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}
|
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
<form method="post" class="form form-horizontal">
|
|
|
|
{% csrf_token %}
|
|
|
|
{# "Select all" form #}
|
|
|
|
{% if table.paginator.num_pages > 1 %}
|
|
|
|
<div id="select-all-box" class="d-none card noprint">
|
|
|
|
<div class="form col-md-12">
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="float-end">
|
|
|
|
{% 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 %}
|
|
|
|
</div>
|
|
|
|
<div class="form-check">
|
|
|
|
<input type="checkbox" id="select-all" name="_all" class="form-check-input" />
|
|
|
|
<label for="select-all" class="form-check-label">
|
2023-08-02 14:53:32 -04:00
|
|
|
{% blocktrans with count=table.rows|length object_type_plural=table.data.verbose_name_plural %}
|
|
|
|
Select <strong>all {{ count }} {{ object_type_plural }}</strong> matching query
|
|
|
|
{% endblocktrans %}
|
2022-11-04 11:00:35 -07:00
|
|
|
</label>
|
|
|
|
</div>
|
2022-03-02 16:13:59 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-04 11:00:35 -07:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-08-06 15:35:14 -04:00
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
<div class="form form-horizontal">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
|
2021-08-06 15:35:14 -04:00
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
{# Object table #}
|
2022-08-18 13:58:40 -07:00
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
{% if prerequisite_model %}
|
|
|
|
{% include 'inc/missing_prerequisites.html' %}
|
|
|
|
{% endif %}
|
2022-08-18 13:58:40 -07:00
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
<div class="card">
|
2023-01-16 15:50:45 -05:00
|
|
|
<div class="card-body htmx-container table-responsive" id="object_list">
|
2022-11-04 11:00:35 -07:00
|
|
|
{% include 'htmx/table.html' %}
|
|
|
|
</div>
|
2021-07-10 22:06:28 -04:00
|
|
|
</div>
|
2021-08-06 15:35:14 -04:00
|
|
|
|
2022-11-04 11:00:35 -07:00
|
|
|
{# Form buttons #}
|
|
|
|
<div class="noprint bulk-buttons">
|
|
|
|
<div class="bulk-button-group">
|
|
|
|
{% block bulk_buttons %}
|
|
|
|
{% 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 %}
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
2022-02-24 16:33:51 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-08-06 15:35:14 -04:00
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{# Filter form #}
|
|
|
|
{% if filter_form %}
|
|
|
|
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
|
|
|
|
{% include 'inc/filter_list.html' %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-07-10 22:06:28 -04:00
|
|
|
</div>
|
2021-08-06 15:35:14 -04:00
|
|
|
|
|
|
|
{% endblock content-wrapper %}
|
2022-01-05 09:21:48 -05:00
|
|
|
|
|
|
|
{% block modals %}
|
|
|
|
{% table_config_form table table_name="ObjectTable" %}
|
|
|
|
{% endblock modals %}
|