Fix up duplication of template chits when rendering HTMX

This commit is contained in:
Daniel Sheppard 2024-04-22 22:42:42 -05:00
parent 1c995fa5f9
commit 479c69bd2d
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@ from django.db.models.fields.reverse_related import ManyToManyRel
from django.forms import HiddenInput, ModelMultipleChoiceField, MultipleHiddenInput
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
@ -180,10 +181,14 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
# Hide selection checkboxes
if 'pk' in table.base_columns:
table.columns.hide('pk')
return render(request, 'htmx/table.html', {
applied_filters = render_to_string('inc/applied_filters_pane.html', {
'model': model,
'table': table,
'filter_form': filterset_form,
}, request)
return render(request, 'htmx/table.html', {
'table': table,
'applied_filters': applied_filters,
})
context = {

View File

@ -2,8 +2,8 @@
{% load helpers %}
{% load render_table from django_tables2 %}
{# Applied filters #}
{% include 'inc/applied_filters_pane.html' %}
{# Applied filters for OOB Swap #}
{{ applied_filters }}
{% with preferences|get_key:"pagination.placement" as paginator_placement %}
{% if paginator_placement == 'top' or paginator_placement == 'both' %}