diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 3460d4626..b549b3a01 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -34,9 +34,7 @@ class ProviderView(generic.ObjectView): ).prefetch_related( 'type', 'tenant', 'terminations__site' ) - - circuits_table = tables.CircuitTable(circuits) - circuits_table.columns.hide('provider') + circuits_table = tables.CircuitTable(circuits, exclude=('provider',)) paginate_table(circuits_table, request) return { @@ -97,10 +95,7 @@ class ProviderNetworkView(generic.ObjectView): ).prefetch_related( 'type', 'tenant', 'terminations__site' ) - circuits_table = tables.CircuitTable(circuits) - circuits_table.columns.hide('termination_a') - circuits_table.columns.hide('termination_z') paginate_table(circuits_table, request) return { @@ -153,12 +148,8 @@ class CircuitTypeView(generic.ObjectView): queryset = CircuitType.objects.all() def get_extra_context(self, request, instance): - circuits = Circuit.objects.restrict(request.user, 'view').filter( - type=instance - ) - - circuits_table = tables.CircuitTable(circuits) - circuits_table.columns.hide('type') + circuits = Circuit.objects.restrict(request.user, 'view').filter(type=instance) + circuits_table = tables.CircuitTable(circuits, exclude=('type',)) paginate_table(circuits_table, request) return { diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index fbdd30a3d..63f2be5c8 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -131,8 +131,7 @@ class RegionView(generic.ObjectView): sites = Site.objects.restrict(request.user, 'view').filter( region=instance ) - sites_table = tables.SiteTable(sites) - sites_table.columns.hide('region') + sites_table = tables.SiteTable(sites, exclude=('region',)) paginate_table(sites_table, request) return { @@ -216,8 +215,7 @@ class SiteGroupView(generic.ObjectView): sites = Site.objects.restrict(request.user, 'view').filter( group=instance ) - sites_table = tables.SiteTable(sites) - sites_table.columns.hide('group') + sites_table = tables.SiteTable(sites, exclude=('group',)) paginate_table(sites_table, request) return { @@ -453,10 +451,7 @@ class RackRoleView(generic.ObjectView): role=instance ) - racks_table = tables.RackTable(racks) - racks_table.columns.hide('role') - racks_table.columns.hide('get_utilization') - racks_table.columns.hide('get_power_utilization') + racks_table = tables.RackTable(racks, exclude=('role', 'get_utilization', 'get_power_utilization')) paginate_table(racks_table, request) return { @@ -706,8 +701,7 @@ class ManufacturerView(generic.ObjectView): manufacturer=instance ) - devicetypes_table = tables.DeviceTypeTable(devicetypes) - devicetypes_table.columns.hide('manufacturer') + devicetypes_table = tables.DeviceTypeTable(devicetypes, exclude=('manufacturer',)) paginate_table(devicetypes_table, request) return { @@ -1167,9 +1161,7 @@ class DeviceRoleView(generic.ObjectView): devices = Device.objects.restrict(request.user, 'view').filter( device_role=instance ) - - devices_table = tables.DeviceTable(devices) - devices_table.columns.hide('device_role') + devices_table = tables.DeviceTable(devices, exclude=('device_role',)) paginate_table(devices_table, request) return { @@ -1233,9 +1225,7 @@ class PlatformView(generic.ObjectView): devices = Device.objects.restrict(request.user, 'view').filter( platform=instance ) - - devices_table = tables.DeviceTable(devices) - devices_table.columns.hide('platform') + devices_table = tables.DeviceTable(devices, exclude=('platform',)) paginate_table(devices_table, request) return { @@ -1880,9 +1870,9 @@ class InterfaceView(generic.ObjectView): child_interfaces = Interface.objects.restrict(request.user, 'view').filter(parent=instance) child_interfaces_tables = tables.InterfaceTable( child_interfaces, + exclude=('device', 'parent'), orderable=False ) - child_interfaces_tables.columns.hide('device') # Get assigned VLANs and annotate whether each is tagged or untagged vlans = [] diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 6d49cd24f..015d47065 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -155,10 +155,7 @@ class RIRView(generic.ObjectView): aggregates = Aggregate.objects.restrict(request.user, 'view').filter( rir=instance ) - - aggregates_table = tables.AggregateTable(aggregates) - aggregates_table.columns.hide('rir') - aggregates_table.columns.hide('utilization') + aggregates_table = tables.AggregateTable(aggregates, exclude=('rir', 'utilization')) paginate_table(aggregates_table, request) return { diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index 22d669a0d..0b28a62d2 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -32,9 +32,7 @@ class TenantGroupView(generic.ObjectView): tenants = Tenant.objects.restrict(request.user, 'view').filter( group=instance ) - - tenants_table = tables.TenantTable(tenants) - tenants_table.columns.hide('group') + tenants_table = tables.TenantTable(tenants, exclude=('group',)) paginate_table(tenants_table, request) return { diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 8315ba0a6..a8b2b8f1f 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -39,9 +39,7 @@ class ClusterTypeView(generic.ObjectView): device_count=count_related(Device, 'cluster'), vm_count=count_related(VirtualMachine, 'cluster') ) - - clusters_table = tables.ClusterTable(clusters) - clusters_table.columns.hide('type') + clusters_table = tables.ClusterTable(clusters, exclude=('type',)) paginate_table(clusters_table, request) return { @@ -103,9 +101,7 @@ class ClusterGroupView(generic.ObjectView): device_count=count_related(Device, 'cluster'), vm_count=count_related(VirtualMachine, 'cluster') ) - - clusters_table = tables.ClusterTable(clusters) - clusters_table.columns.hide('group') + clusters_table = tables.ClusterTable(clusters, exclude=('group',)) paginate_table(clusters_table, request) return { @@ -434,9 +430,9 @@ class VMInterfaceView(generic.ObjectView): child_interfaces = VMInterface.objects.restrict(request.user, 'view').filter(parent=instance) child_interfaces_tables = tables.VMInterfaceTable( child_interfaces, + exclude=('virtual_machine',), orderable=False ) - child_interfaces_tables.columns.hide('virtual_machine') # Get assigned VLANs and annotate whether each is tagged or untagged vlans = []