diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py
index 3168509ba..021709be1 100644
--- a/netbox/circuits/views.py
+++ b/netbox/circuits/views.py
@@ -29,20 +29,6 @@ class ProviderListView(generic.ObjectListView):
class ProviderView(generic.ObjectView):
queryset = Provider.objects.all()
- def get_extra_context(self, request, instance):
- circuits = Circuit.objects.restrict(request.user, 'view').filter(
- provider=instance
- ).prefetch_related(
- 'tenant__group', 'termination_a__site', 'termination_z__site',
- 'termination_a__provider_network', 'termination_z__provider_network',
- )
- circuits_table = tables.CircuitTable(circuits, user=request.user, exclude=('provider',))
- circuits_table.configure(request)
-
- return {
- 'circuits_table': circuits_table,
- }
-
@register_model_view(Provider, 'edit')
class ProviderEditView(generic.ObjectEditView):
@@ -93,21 +79,6 @@ class ProviderNetworkListView(generic.ObjectListView):
class ProviderNetworkView(generic.ObjectView):
queryset = ProviderNetwork.objects.all()
- def get_extra_context(self, request, instance):
- circuits = Circuit.objects.restrict(request.user, 'view').filter(
- Q(termination_a__provider_network=instance.pk) |
- Q(termination_z__provider_network=instance.pk)
- ).prefetch_related(
- 'tenant__group', 'termination_a__site', 'termination_z__site',
- 'termination_a__provider_network', 'termination_z__provider_network',
- )
- circuits_table = tables.CircuitTable(circuits, user=request.user)
- circuits_table.configure(request)
-
- return {
- 'circuits_table': circuits_table,
- }
-
@register_model_view(ProviderNetwork, 'edit')
class ProviderNetworkEditView(generic.ObjectEditView):
@@ -156,15 +127,6 @@ class CircuitTypeListView(generic.ObjectListView):
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, user=request.user, exclude=('type',))
- circuits_table.configure(request)
-
- return {
- 'circuits_table': circuits_table,
- }
-
@register_model_view(CircuitType, 'edit')
class CircuitTypeEditView(generic.ObjectEditView):
diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py
index 794d58d1e..81b646383 100644
--- a/netbox/dcim/views.py
+++ b/netbox/dcim/views.py
@@ -581,20 +581,6 @@ class RackRoleListView(generic.ObjectListView):
class RackRoleView(generic.ObjectView):
queryset = RackRole.objects.all()
- def get_extra_context(self, request, instance):
- racks = Rack.objects.restrict(request.user, 'view').filter(role=instance).annotate(
- device_count=count_related(Device, 'rack')
- )
-
- racks_table = tables.RackTable(racks, user=request.user, exclude=(
- 'role', 'get_utilization', 'get_power_utilization',
- ))
- racks_table.configure(request)
-
- return {
- 'racks_table': racks_table,
- }
-
@register_model_view(RackRole, 'edit')
class RackRoleEditView(generic.ObjectEditView):
@@ -855,8 +841,6 @@ class ManufacturerView(generic.ObjectView):
def get_extra_context(self, request, instance):
device_types = DeviceType.objects.restrict(request.user, 'view').filter(
manufacturer=instance
- ).annotate(
- instance_count=count_related(Device, 'device_type')
)
module_types = ModuleType.objects.restrict(request.user, 'view').filter(
manufacturer=instance
@@ -865,13 +849,10 @@ class ManufacturerView(generic.ObjectView):
manufacturer=instance
)
- devicetypes_table = tables.DeviceTypeTable(device_types, user=request.user, exclude=('manufacturer',))
- devicetypes_table.configure(request)
-
return {
- 'devicetypes_table': devicetypes_table,
- 'inventory_item_count': inventory_items.count(),
- 'module_type_count': module_types.count(),
+ 'devicetype_count': device_types.count(),
+ 'inventoryitem_count': inventory_items.count(),
+ 'moduletype_count': module_types.count(),
}
@@ -1722,19 +1703,6 @@ class DeviceRoleListView(generic.ObjectListView):
class DeviceRoleView(generic.ObjectView):
queryset = DeviceRole.objects.all()
- def get_extra_context(self, request, instance):
- devices = Device.objects.restrict(request.user, 'view').filter(
- device_role=instance
- )
- devices_table = tables.DeviceTable(devices, user=request.user, exclude=('device_role',))
- devices_table.configure(request)
-
- return {
- 'devices_table': devices_table,
- 'device_count': Device.objects.filter(device_role=instance).count(),
- 'virtualmachine_count': VirtualMachine.objects.filter(role=instance).count(),
- }
-
@register_model_view(DeviceRole, 'edit')
class DeviceRoleEditView(generic.ObjectEditView):
@@ -1793,12 +1761,13 @@ class PlatformView(generic.ObjectView):
devices = Device.objects.restrict(request.user, 'view').filter(
platform=instance
)
- devices_table = tables.DeviceTable(devices, user=request.user, exclude=('platform',))
- devices_table.configure(request)
+ virtual_machines = VirtualMachine.objects.restrict(request.user, 'view').filter(
+ platform=instance
+ )
return {
- 'devices_table': devices_table,
- 'virtualmachine_count': VirtualMachine.objects.filter(platform=instance).count()
+ 'device_count': devices.count(),
+ 'virtualmachine_count': virtual_machines.count()
}
@@ -3615,16 +3584,6 @@ class VirtualDeviceContextListView(generic.ObjectListView):
class VirtualDeviceContextView(generic.ObjectView):
queryset = VirtualDeviceContext.objects.all()
- def get_extra_context(self, request, instance):
- interfaces_table = tables.InterfaceTable(instance.interfaces, user=request.user)
- interfaces_table.configure(request)
- interfaces_table.columns.hide('device')
-
- return {
- 'interfaces_table': interfaces_table,
- 'interface_count': instance.interfaces.count(),
- }
-
@register_model_view(VirtualDeviceContext, 'edit')
class VirtualDeviceContextEditView(generic.ObjectEditView):
diff --git a/netbox/templates/circuits/circuittype.html b/netbox/templates/circuits/circuittype.html
index c2ab235e4..4cefecc87 100644
--- a/netbox/templates/circuits/circuittype.html
+++ b/netbox/templates/circuits/circuittype.html
@@ -31,7 +31,7 @@
Circuits |
- {{ circuits_table.rows|length }}
+ {{ object.circuits.count }}
|
@@ -49,10 +49,10 @@
-
- {% render_table circuits_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html
index 51f911350..8cd7e59fb 100644
--- a/netbox/templates/circuits/provider.html
+++ b/netbox/templates/circuits/provider.html
@@ -40,7 +40,7 @@
Circuits |
- {{ circuits_table.rows|length }}
+ {{ object.circuits.count }}
|
@@ -60,10 +60,10 @@
-
- {% render_table circuits_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/circuits/providernetwork.html b/netbox/templates/circuits/providernetwork.html
index 4987722a5..29c31ab47 100644
--- a/netbox/templates/circuits/providernetwork.html
+++ b/netbox/templates/circuits/providernetwork.html
@@ -50,10 +50,10 @@
-
- {% render_table circuits_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/devicerole.html b/netbox/templates/dcim/devicerole.html
index 610c53071..b68eb081b 100644
--- a/netbox/templates/dcim/devicerole.html
+++ b/netbox/templates/dcim/devicerole.html
@@ -45,14 +45,14 @@
Devices |
- {{ device_count }}
+ {{ object.devices.count }}
|
Virtual Machines |
{% if object.vm_role %}
- {{ virtualmachine_count }}
+ {{ object.virtual_machines.count }}
{% else %}
{{ ''|placeholder }}
{% endif %}
@@ -73,10 +73,10 @@
-
- {% render_table devices_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=devices_table.paginator page=devices_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/manufacturer.html b/netbox/templates/dcim/manufacturer.html
index ad975f2ea..260f8e39a 100644
--- a/netbox/templates/dcim/manufacturer.html
+++ b/netbox/templates/dcim/manufacturer.html
@@ -45,19 +45,19 @@
|
Device types |
- {{ devicetypes_table.rows|length }}
+ {{ devicetype_count }}
|
Module types |
- {{ module_type_count }}
+ {{ moduletype_count }}
|
Inventory Items |
- {{ inventory_item_count }}
+ {{ inventoryitem_count }}
|
@@ -76,10 +76,10 @@
-
- {% render_table devicetypes_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=devicetypes_table.paginator page=devicetypes_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/platform.html b/netbox/templates/dcim/platform.html
index 8d1e3797a..f134ac649 100644
--- a/netbox/templates/dcim/platform.html
+++ b/netbox/templates/dcim/platform.html
@@ -46,7 +46,7 @@
Devices |
- {{ devices_table.rows|length }}
+ {{ device_count }}
|
@@ -78,10 +78,10 @@
-
- {% render_table devices_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=devices_table.paginator page=devices_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/rackrole.html b/netbox/templates/dcim/rackrole.html
index 8c31be482..0f229e910 100644
--- a/netbox/templates/dcim/rackrole.html
+++ b/netbox/templates/dcim/rackrole.html
@@ -37,7 +37,7 @@
Racks |
- {{ racks_table.rows|length }}
+ {{ object.racks.count }}
|
@@ -55,10 +55,10 @@
-
- {% render_table racks_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=racks_table.paginator page=racks_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/virtualdevicecontext.html b/netbox/templates/dcim/virtualdevicecontext.html
index c7b2b9659..ee30db19e 100644
--- a/netbox/templates/dcim/virtualdevicecontext.html
+++ b/netbox/templates/dcim/virtualdevicecontext.html
@@ -49,6 +49,12 @@
{{ object.tenant|linkify|placeholder }}
+
+ Interfaces |
+
+ {{ object.interfaces.count }}
+ |
+
@@ -65,10 +71,10 @@
-
- {% render_table interfaces_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=interfaces_table.paginator page=interfaces_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/tenancy/contactgroup.html b/netbox/templates/tenancy/contactgroup.html
index 3f13dc932..f9f2170a8 100644
--- a/netbox/templates/tenancy/contactgroup.html
+++ b/netbox/templates/tenancy/contactgroup.html
@@ -34,7 +34,7 @@
Contacts |
- {{ contacts_table.rows|length }}
+ {{ object.contacts.count }}
|
@@ -63,16 +63,14 @@
{% plugin_right_page object %}
-
-
-
-
-
- {% render_table contacts_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=contacts_table.paginator page=contacts_table.page %}
-
-
- {% plugin_full_width_page object %}
+
+
+ {% plugin_full_width_page object %}
{% endblock %}
diff --git a/netbox/templates/tenancy/tenantgroup.html b/netbox/templates/tenancy/tenantgroup.html
index 25f1fef1b..4e2ef2280 100644
--- a/netbox/templates/tenancy/tenantgroup.html
+++ b/netbox/templates/tenancy/tenantgroup.html
@@ -42,7 +42,7 @@
Tenants |
- {{ tenants_table.rows|length }}
+ {{ object.tenants.count }}
|
@@ -60,10 +60,10 @@
-
- {% render_table tenants_table 'inc/table.html' %}
- {% include 'inc/paginator.html' with paginator=tenants_table.paginator page=tenants_table.page %}
-
+
{% plugin_full_width_page object %}
diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py
index f4c9b6d04..f7db63480 100644
--- a/netbox/tenancy/views.py
+++ b/netbox/tenancy/views.py
@@ -34,17 +34,6 @@ class TenantGroupListView(generic.ObjectListView):
class TenantGroupView(generic.ObjectView):
queryset = TenantGroup.objects.all()
- def get_extra_context(self, request, instance):
- tenants = Tenant.objects.restrict(request.user, 'view').filter(
- group=instance
- )
- tenants_table = tables.TenantTable(tenants, user=request.user, exclude=('group',))
- tenants_table.configure(request)
-
- return {
- 'tenants_table': tenants_table,
- }
-
@register_model_view(TenantGroup, 'edit')
class TenantGroupEditView(generic.ObjectEditView):
@@ -195,17 +184,8 @@ class ContactGroupView(generic.ObjectView):
child_groups_table = tables.ContactGroupTable(child_groups)
child_groups_table.columns.hide('actions')
- contacts = Contact.objects.restrict(request.user, 'view').filter(
- group=instance
- ).annotate(
- assignment_count=count_related(ContactAssignment, 'contact')
- )
- contacts_table = tables.ContactTable(contacts, user=request.user, exclude=('group',))
- contacts_table.configure(request)
-
return {
'child_groups_table': child_groups_table,
- 'contacts_table': contacts_table,
}