diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 32badd2d5..5f3046c6a 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -216,7 +216,6 @@ class ASNRangeASNsView(generic.ObjectChildrenView): child_model = ASN table = tables.ASNTable filterset = filtersets.ASNFilterSet - template_name = 'ipam/asnrange/asns.html' tab = ViewTab( label=_('ASNs'), badge=lambda x: x.get_child_asns().count(), @@ -367,7 +366,9 @@ class AggregatePrefixesView(generic.ObjectChildrenView): return add_requested_prefixes(parent.prefix, queryset, show_available, show_assigned) def get_extra_context(self, request, instance): + context = super().get_extra_context(request, instance) return { + **context, 'bulk_querystring': f'within={instance.prefix}', 'first_available_prefix': instance.get_first_available_prefix(), 'show_available': bool(request.GET.get('show_available', 'true') == 'true'), @@ -554,7 +555,9 @@ class PrefixPrefixesView(generic.ObjectChildrenView): return add_requested_prefixes(parent.prefix, queryset, show_available, show_assigned) def get_extra_context(self, request, instance): + context = super().get_extra_context(request, instance) return { + **context, 'bulk_querystring': f"vrf_id={instance.vrf.pk if instance.vrf else '0'}&within={instance.prefix}", 'first_available_prefix': instance.get_first_available_prefix(), 'show_available': bool(request.GET.get('show_available', 'true') == 'true'), @@ -582,7 +585,9 @@ class PrefixIPRangesView(generic.ObjectChildrenView): ) def get_extra_context(self, request, instance): + context = super().get_extra_context(request, instance) return { + **context, 'bulk_querystring': f"vrf_id={instance.vrf.pk if instance.vrf else '0'}&parent={instance.prefix}", 'first_available_ip': instance.get_first_available_ip(), } @@ -611,7 +616,9 @@ class PrefixIPAddressesView(generic.ObjectChildrenView): return queryset def get_extra_context(self, request, instance): + context = super().get_extra_context(request, instance) return { + **context, 'bulk_querystring': f"vrf_id={instance.vrf.pk if instance.vrf else '0'}&parent={instance.prefix}", 'first_available_ip': instance.get_first_available_ip(), } @@ -816,7 +823,6 @@ class IPAddressAssignView(generic.ObjectView): table = None if form.is_valid(): - addresses = self.queryset.prefetch_related('vrf', 'tenant') # Limit to 100 results addresses = filtersets.IPAddressFilterSet(request.POST, addresses).qs[:100] @@ -866,7 +872,6 @@ class IPAddressRelatedIPsView(generic.ObjectChildrenView): child_model = IPAddress table = tables.IPAddressTable filterset = filtersets.IPAddressFilterSet - template_name = 'ipam/ipaddress/ip_addresses.html' tab = ViewTab( label=_('Related IPs'), badge=lambda x: x.get_related_ips().count(), @@ -963,7 +968,6 @@ class FHRPGroupView(generic.ObjectView): queryset = FHRPGroup.objects.all() def get_extra_context(self, request, instance): - # Get assigned interfaces members_table = tables.FHRPGroupAssignmentTable( data=FHRPGroupAssignment.objects.restrict(request.user, 'view').filter(group=instance), @@ -1077,7 +1081,6 @@ class VLANInterfacesView(generic.ObjectChildrenView): child_model = Interface table = tables.VLANDevicesTable filterset = InterfaceFilterSet - template_name = 'ipam/vlan/interfaces.html' tab = ViewTab( label=_('Device Interfaces'), badge=lambda x: x.get_interfaces().count(), @@ -1095,7 +1098,6 @@ class VLANVMInterfacesView(generic.ObjectChildrenView): child_model = VMInterface table = tables.VLANVirtualMachinesTable filterset = VMInterfaceFilterSet - template_name = 'ipam/vlan/vminterfaces.html' tab = ViewTab( label=_('VM Interfaces'), badge=lambda x: x.get_vminterfaces().count(), diff --git a/netbox/netbox/views/generic/object_views.py b/netbox/netbox/views/generic/object_views.py index 1ba789cf1..af7b3bab3 100644 --- a/netbox/netbox/views/generic/object_views.py +++ b/netbox/netbox/views/generic/object_views.py @@ -6,6 +6,7 @@ from django.db import transaction from django.db.models import ProtectedError from django.shortcuts import redirect, render from django.urls import reverse +from django.urls.exceptions import NoReverseMatch from django.utils.html import escape from django.utils.safestring import mark_safe @@ -90,6 +91,7 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin): child_model = None table = None filterset = None + template_name = 'inc/tab_view.html' def get_children(self, request, parent): """ @@ -112,6 +114,28 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin): """ return queryset + def get_extra_context(self, request, instance): + context = super().get_extra_context(request, instance) + + return_url = '?return_url=' + request.get_full_path() + bulk_edit_url = reverse(f'{self.child_model._meta.app_label}:{self.child_model._meta.model_name}_bulk_edit') + return_url + bulk_delete_url = reverse(f'{self.child_model._meta.app_label}:{self.child_model._meta.model_name}_bulk_delete') + return_url + + try: + bulk_rename_url = reverse( + f'{self.child_model._meta.app_label}:{self.child_model._meta.model_name}_bulk_rename') + return_url + except NoReverseMatch: + bulk_rename_url = None + + context.update({ + 'base_template': f'{instance._meta.app_label}/{instance._meta.model_name}.html', + 'table_config': f'{self.table.__name__}_config', + 'bulk_edit_url': bulk_edit_url, + 'bulk_delete_url': bulk_delete_url, + 'bulk_rename_url': bulk_rename_url, + }) + return context + # # Request handlers # diff --git a/netbox/templates/dcim/device/consoleports.html b/netbox/templates/dcim/device/consoleports.html index ccd12f61c..518ecf2a4 100644 --- a/netbox/templates/dcim/device/consoleports.html +++ b/netbox/templates/dcim/device/consoleports.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceConsolePortTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_consoleport %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_consoleserverport %} - {% endif %} -
-
+ {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/consoleserverports.html b/netbox/templates/dcim/device/consoleserverports.html index 43396651d..45f99f5b6 100644 --- a/netbox/templates/dcim/device/consoleserverports.html +++ b/netbox/templates/dcim/device/consoleserverports.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceConsoleServerPortTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_consoleserverport %} - - {% endif %} -
-
+{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_consoleserverport %} +
+ + Add Console Server Ports + +
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/devicebays.html b/netbox/templates/dcim/device/devicebays.html index 9453b9a59..92711909c 100644 --- a/netbox/templates/dcim/device/devicebays.html +++ b/netbox/templates/dcim/device/devicebays.html @@ -1,50 +1,12 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceDeviceBayTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
- {% if perms.dcim.add_devicebay %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_devicebay %} - {% endif %} -
-
+ {% endif %} {% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/dcim/device/frontports.html b/netbox/templates/dcim/device/frontports.html index dd0767d95..eb4f96ca5 100644 --- a/netbox/templates/dcim/device/frontports.html +++ b/netbox/templates/dcim/device/frontports.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceFrontPortTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_frontport %} - - {% endif %} -
-
+{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_frontport %} +
+ + Add front ports + +
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/interfaces.html b/netbox/templates/dcim/device/interfaces.html index c0e9a38b6..9d7d28d8a 100644 --- a/netbox/templates/dcim/device/interfaces.html +++ b/netbox/templates/dcim/device/interfaces.html @@ -1,66 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'dcim/device/inc/interface_table_controls.html' with table_modal="DeviceInterfaceTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_interface %} - + {% endif %} -
-
{% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_interface %} +
+ + Add Interfaces + +
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/inventory.html b/netbox/templates/dcim/device/inventory.html index 9e11031ec..ef4071ca9 100644 --- a/netbox/templates/dcim/device/inventory.html +++ b/netbox/templates/dcim/device/inventory.html @@ -1,50 +1,12 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceInventoryItemTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
- {% if perms.dcim.add_inventoryitem %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_inventoryitem %} - {% endif %} -
-
+ {% endif %} {% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/dcim/device/modulebays.html b/netbox/templates/dcim/device/modulebays.html index 7f0aacf1f..d24755c20 100644 --- a/netbox/templates/dcim/device/modulebays.html +++ b/netbox/templates/dcim/device/modulebays.html @@ -1,46 +1,12 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceModuleBayTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
- {% if perms.dcim.add_modulebay %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_modulebay %} - {% endif %} -
-
- {% table_config_form table %} -{% endblock %} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/poweroutlets.html b/netbox/templates/dcim/device/poweroutlets.html index 66b21b7af..58d69a5cc 100644 --- a/netbox/templates/dcim/device/poweroutlets.html +++ b/netbox/templates/dcim/device/poweroutlets.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DevicePowerOutletTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_poweroutlet %} - - {% endif %} -
-
+{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_poweroutlet %} +
+ + Add Power Outlets + +
+ {% endif %} +{% endblock %} diff --git a/netbox/templates/dcim/device/powerports.html b/netbox/templates/dcim/device/powerports.html index d9e1e121a..f17c81e6d 100644 --- a/netbox/templates/dcim/device/powerports.html +++ b/netbox/templates/dcim/device/powerports.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} -{% load static %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DevicePowerPortTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_powerport %} - - {% endif %} -
-
+{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_powerport %} +
+ + Add Power Port + +
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/device/rearports.html b/netbox/templates/dcim/device/rearports.html index ce194cc78..dcee920b5 100644 --- a/netbox/templates/dcim/device/rearports.html +++ b/netbox/templates/dcim/device/rearports.html @@ -1,57 +1,22 @@ -{% extends 'dcim/device/base.html' %} -{% load render_table from django_tables2 %} -{% load static %} -{% load helpers %} +{% extends 'inc/tab_view.html' %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceRearPortTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} -
- - -
- {% endif %} -
- {% if 'bulk_delete' in actions %} - - {% endif %} - {% if 'bulk_edit' in actions %} - - {% endif %} -
-
- {% if perms.dcim.add_rearport %} - - {% endif %} -
-
+{% block bulk_delete_control %} + {% if 'bulk_edit' in actions %} + + {% endif %} {% endblock %} -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} +{% block extra_contols_bottom %} + {% if perms.dcim.add_rearport %} +
+ + Add rear ports + +
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/dcim/rack/non_racked_devices.html b/netbox/templates/dcim/rack/non_racked_devices.html index 700c66369..ee3736f03 100644 --- a/netbox/templates/dcim/rack/non_racked_devices.html +++ b/netbox/templates/dcim/rack/non_racked_devices.html @@ -1,4 +1,4 @@ -{% extends 'dcim/rack/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -11,41 +11,3 @@ {% endif %} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/dcim/rack/reservations.html b/netbox/templates/dcim/rack/reservations.html index fb357e592..e4d4b8dfb 100644 --- a/netbox/templates/dcim/rack/reservations.html +++ b/netbox/templates/dcim/rack/reservations.html @@ -1,43 +1,13 @@ -{% extends 'dcim/rack/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="RackReservationTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
- {% if perms.dcim.add_rackreservation %} +{% block extra_controls %} + {% if perms.dcim.add_rackreservation %} - {% endif %} -
-
+ {% endif %} {% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/inc/tab_view.html b/netbox/templates/inc/tab_view.html new file mode 100644 index 000000000..12c65f041 --- /dev/null +++ b/netbox/templates/inc/tab_view.html @@ -0,0 +1,55 @@ +{% extends base_template %} +{% load helpers %} + +{% block content %} + {% include 'inc/table_controls_htmx.html' with table_modal=table_config %} +
+ {% csrf_token %} +
+
+ {% include 'htmx/table.html' %} +
+
+ + {% block bulk_controls %} +
+
+ {% if 'bulk_edit' in actions %} +
+ + {% if bulk_rename_url %} + + {% endif %} +
+ {% endif %} +
+ {% if 'bulk_delete' in actions %} + + {% endif %} + {% block bulk_delete_control %} + {% endblock %} +
+
+ {% block extra_contols_bottom %} + {% endblock %} +
+ {% endblock %} +
+{% endblock content %} + +{% block modals %} + {{ block.super }} + {% table_config_form table %} +{% endblock modals %} diff --git a/netbox/templates/ipam/aggregate/prefixes.html b/netbox/templates/ipam/aggregate/prefixes.html index a1d3bd276..e93d0cf42 100644 --- a/netbox/templates/ipam/aggregate/prefixes.html +++ b/netbox/templates/ipam/aggregate/prefixes.html @@ -1,4 +1,4 @@ -{% extends 'ipam/aggregate/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -10,37 +10,3 @@ {% endif %} {{ block.super }} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="PrefixTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/asnrange/asns.html b/netbox/templates/ipam/asnrange/asns.html deleted file mode 100644 index 69d4e8abb..000000000 --- a/netbox/templates/ipam/asnrange/asns.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends 'ipam/asnrange/base.html' %} -{% load helpers %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="ASNTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/ipaddress/ip_addresses.html b/netbox/templates/ipam/ipaddress/ip_addresses.html deleted file mode 100644 index b82ec2375..000000000 --- a/netbox/templates/ipam/ipaddress/ip_addresses.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends 'ipam/ipaddress/base.html' %} -{% load helpers %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="IPAddressTable_config" %} -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/iprange/ip_addresses.html b/netbox/templates/ipam/iprange/ip_addresses.html index 9f77f6c78..9acb6a1fb 100644 --- a/netbox/templates/ipam/iprange/ip_addresses.html +++ b/netbox/templates/ipam/iprange/ip_addresses.html @@ -1,4 +1,4 @@ -{% extends 'ipam/iprange/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -8,37 +8,3 @@ {% endif %} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="IPAddressTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/prefix/ip_addresses.html b/netbox/templates/ipam/prefix/ip_addresses.html index fe68039f8..f734e06cc 100644 --- a/netbox/templates/ipam/prefix/ip_addresses.html +++ b/netbox/templates/ipam/prefix/ip_addresses.html @@ -1,4 +1,4 @@ -{% extends 'ipam/prefix/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -8,37 +8,3 @@ {% endif %} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="IPAddressTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/prefix/ip_ranges.html b/netbox/templates/ipam/prefix/ip_ranges.html index 4452fd5a7..2b2d021da 100644 --- a/netbox/templates/ipam/prefix/ip_ranges.html +++ b/netbox/templates/ipam/prefix/ip_ranges.html @@ -1,4 +1,4 @@ -{% extends 'ipam/prefix/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -8,37 +8,3 @@ {% endif %} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="IPRangeTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/prefix/prefixes.html b/netbox/templates/ipam/prefix/prefixes.html index 5fc931f74..eafcb6b47 100644 --- a/netbox/templates/ipam/prefix/prefixes.html +++ b/netbox/templates/ipam/prefix/prefixes.html @@ -1,4 +1,4 @@ -{% extends 'ipam/prefix/base.html' %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -10,37 +10,3 @@ {% endif %} {{ block.super }} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="PrefixTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/vlan/interfaces.html b/netbox/templates/ipam/vlan/interfaces.html deleted file mode 100644 index f7bcc8563..000000000 --- a/netbox/templates/ipam/vlan/interfaces.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends 'ipam/vlan/base.html' %} -{% load helpers %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="VLANDevicesTable_config" %} - -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/ipam/vlan/vminterfaces.html b/netbox/templates/ipam/vlan/vminterfaces.html deleted file mode 100644 index a485b33eb..000000000 --- a/netbox/templates/ipam/vlan/vminterfaces.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends 'ipam/vlan/base.html' %} -{% load helpers %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="VLANVirtualMachinesTable_config" %} - -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/tenancy/object_contacts.html b/netbox/templates/tenancy/object_contacts.html index e13fedc43..9237cbe67 100644 --- a/netbox/templates/tenancy/object_contacts.html +++ b/netbox/templates/tenancy/object_contacts.html @@ -1,4 +1,4 @@ -{% extends base_template %} +{% extends 'inc/tab_view.html' %} {% load helpers %} {% block extra_controls %} @@ -10,20 +10,3 @@ {% endwith %} {% endif %} {% endblock %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="ContactAssignmentTable_config" %} -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/virtualization/cluster/devices.html b/netbox/templates/virtualization/cluster/devices.html deleted file mode 100644 index 083798233..000000000 --- a/netbox/templates/virtualization/cluster/devices.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends 'virtualization/cluster/base.html' %} -{% load helpers %} -{% load render_table from django_tables2 %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="DeviceTable_config" %} - -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-
- {% if perms.virtualization.change_cluster %} - - {% endif %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/virtualization/cluster/virtual_machines.html b/netbox/templates/virtualization/cluster/virtual_machines.html deleted file mode 100644 index 79c489d6b..000000000 --- a/netbox/templates/virtualization/cluster/virtual_machines.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends 'virtualization/cluster/base.html' %} -{% load helpers %} -{% load render_table from django_tables2 %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="VirtualMachineTable_config" %} - -
- {% csrf_token %} -
-
- {% include 'htmx/table.html' %} -
-
-
-
- {% if 'bulk_edit' in actions %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% endif %} -
-
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/templates/virtualization/virtualmachine/interfaces.html b/netbox/templates/virtualization/virtualmachine/interfaces.html deleted file mode 100644 index 71456d104..000000000 --- a/netbox/templates/virtualization/virtualmachine/interfaces.html +++ /dev/null @@ -1,47 +0,0 @@ -{% extends 'virtualization/virtualmachine/base.html' %} -{% load render_table from django_tables2 %} -{% load helpers %} - -{% block content %} - {% include 'inc/table_controls_htmx.html' with table_modal="VirtualMachineVMInterfaceTable_config" %} - -
- {% csrf_token %} - -
-
- {% include 'htmx/table.html' %} -
-
- -
- {% if perms.virtualization.change_vminterface %} -
- - -
- {% endif %} - {% if perms.virtualization.delete_vminterface %} - - {% endif %} - {% if perms.virtualization.add_vminterface %} - - {% endif %} -
-
-{% endblock content %} - -{% block modals %} - {{ block.super }} - {% table_config_form table %} -{% endblock modals %} diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index 23020e794..3025e7e04 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -41,11 +41,6 @@ class ObjectContactsView(generic.ObjectChildrenView): return table - def get_extra_context(self, request, instance): - return { - 'base_template': f'{instance._meta.app_label}/{instance._meta.model_name}.html', - } - # # Tenant groups # diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 75e83f9e1..6e1773368 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -175,7 +175,6 @@ class ClusterVirtualMachinesView(generic.ObjectChildrenView): child_model = VirtualMachine table = tables.VirtualMachineTable filterset = filtersets.VirtualMachineFilterSet - template_name = 'virtualization/cluster/virtual_machines.html' tab = ViewTab( label=_('Virtual Machines'), badge=lambda obj: obj.virtual_machines.count(), @@ -193,7 +192,6 @@ class ClusterDevicesView(generic.ObjectChildrenView): child_model = Device table = DeviceTable filterset = DeviceFilterSet - template_name = 'virtualization/cluster/devices.html' tab = ViewTab( label=_('Devices'), badge=lambda obj: obj.devices.count(), @@ -346,7 +344,6 @@ class VirtualMachineInterfacesView(generic.ObjectChildrenView): child_model = VMInterface table = tables.VirtualMachineVMInterfaceTable filterset = filtersets.VMInterfaceFilterSet - template_name = 'virtualization/virtualmachine/interfaces.html' tab = ViewTab( label=_('Interfaces'), badge=lambda obj: obj.interfaces.count(),