Add disable_htmx property on ObjectChildrenView to allow IP assignment flow to avoid htmx fragmentary rendering on object save

This commit is contained in:
Brian Tiemann 2024-12-16 18:54:09 -05:00
parent 37c9ed2fef
commit fa8f2ac377
2 changed files with 4 additions and 1 deletions

View File

@ -1971,6 +1971,7 @@ class DeviceInterfacesView(DeviceComponentsView):
filterset = filtersets.InterfaceFilterSet filterset = filtersets.InterfaceFilterSet
filterset_form = forms.InterfaceFilterForm filterset_form = forms.InterfaceFilterForm
template_name = 'dcim/device/interfaces.html' template_name = 'dcim/device/interfaces.html'
disable_htmx = True
tab = ViewTab( tab = ViewTab(
label=_('Interfaces'), label=_('Interfaces'),
badge=lambda obj: obj.vc_interfaces().count(), badge=lambda obj: obj.vc_interfaces().count(),

View File

@ -96,6 +96,8 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
filterset = None filterset = None
filterset_form = None filterset_form = None
template_name = 'generic/object_children.html' template_name = 'generic/object_children.html'
# Currently used only to work around the singular behavior of the IP assignment flow in DeviceInterfacesView
disable_htmx = False
def get_children(self, request, parent): def get_children(self, request, parent):
""" """
@ -142,7 +144,7 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
table = self.get_table(table_data, request, has_bulk_actions) table = self.get_table(table_data, request, has_bulk_actions)
# If this is an HTMX request, return only the rendered table HTML # If this is an HTMX request, return only the rendered table HTML
if htmx_partial(request): if htmx_partial(request) and not self.disable_htmx:
return render(request, 'htmx/table.html', { return render(request, 'htmx/table.html', {
'object': instance, 'object': instance,
'table': table, 'table': table,