Skip to content

Commit

Permalink
Add disable_htmx property on ObjectChildrenView to allow IP assignmen…
Browse files Browse the repository at this point in the history
…t flow to avoid htmx fragmentary rendering on object save
  • Loading branch information
bctiemann committed Dec 16, 2024
1 parent 37c9ed2 commit fa8f2ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions netbox/dcim/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,7 @@ class DeviceInterfacesView(DeviceComponentsView):
filterset = filtersets.InterfaceFilterSet
filterset_form = forms.InterfaceFilterForm
template_name = 'dcim/device/interfaces.html'
disable_htmx = True
tab = ViewTab(
label=_('Interfaces'),
badge=lambda obj: obj.vc_interfaces().count(),
Expand Down
4 changes: 3 additions & 1 deletion netbox/netbox/views/generic/object_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
filterset = None
filterset_form = None
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):
"""
Expand Down Expand Up @@ -142,7 +144,7 @@ def get(self, request, *args, **kwargs):
table = self.get_table(table_data, request, has_bulk_actions)

# 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', {
'object': instance,
'table': table,
Expand Down

0 comments on commit fa8f2ac

Please sign in to comment.