Perform OOB swap for filter badges

This commit is contained in:
Daniel Sheppard 2024-04-15 08:43:51 -05:00
parent 35cff12974
commit 1c995fa5f9
4 changed files with 14 additions and 3 deletions

View File

@ -181,7 +181,9 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
if 'pk' in table.base_columns:
table.columns.hide('pk')
return render(request, 'htmx/table.html', {
'model': model,
'table': table,
'filter_form': filterset_form,
})
context = {

View File

@ -63,9 +63,7 @@ Context:
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
{# Applied filters #}
{% if filter_form %}
{% applied_filters model filter_form request.GET %}
{% endif %}
{% include 'inc/applied_filters_pane.html' %}
{# Object table controls #}
{% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}

View File

@ -2,6 +2,9 @@
{% load helpers %}
{% load render_table from django_tables2 %}
{# Applied filters #}
{% include 'inc/applied_filters_pane.html' %}
{% 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 %}

View File

@ -0,0 +1,8 @@
{% load helpers %}
<div id="applied_filters_pane" hx-swap-oob="true">
{# Applied filters #}
{% if filter_form %}
{% applied_filters model filter_form request.GET %}
{% endif %}
</div>