From 6e037e91d3f750d3b45fdd4e66d06c4c22d91f43 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 18 Jul 2018 15:10:12 -0400 Subject: [PATCH] Fixes #2202: Ditched half-baked concept of tenancy inheritance via VRF --- netbox/templates/ipam/ipaddress.html | 7 ++++--- netbox/templates/ipam/prefix.html | 7 ------- netbox/tenancy/views.py | 10 ++-------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index 1509f35cb..24889972b 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -65,10 +65,11 @@ Tenant {% if ipaddress.tenant %} + {% if ipaddress.tenant.group %} + {{ ipaddress.tenant.group }} + + {% endif %} {{ ipaddress.tenant }} - {% elif ipaddress.vrf.tenant %} - {{ ipaddress.vrf.tenant }} - {% else %} None {% endif %} diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html index 11c5fc405..1b23284f4 100644 --- a/netbox/templates/ipam/prefix.html +++ b/netbox/templates/ipam/prefix.html @@ -35,13 +35,6 @@ {% endif %} {{ prefix.tenant }} - {% elif prefix.vrf.tenant %} - {% if prefix.vrf.tenant.group %} - {{ prefix.vrf.tenant.group }} - - {% endif %} - {{ prefix.vrf.tenant }} - {% else %} None {% endif %} diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index 99c4acc8a..9020a8c19 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -78,14 +78,8 @@ class TenantView(View): 'rackreservation_count': RackReservation.objects.filter(tenant=tenant).count(), 'device_count': Device.objects.filter(tenant=tenant).count(), 'vrf_count': VRF.objects.filter(tenant=tenant).count(), - 'prefix_count': Prefix.objects.filter( - Q(tenant=tenant) | - Q(tenant__isnull=True, vrf__tenant=tenant) - ).count(), - 'ipaddress_count': IPAddress.objects.filter( - Q(tenant=tenant) | - Q(tenant__isnull=True, vrf__tenant=tenant) - ).count(), + 'prefix_count': Prefix.objects.filter(tenant=tenant).count(), + 'ipaddress_count': IPAddress.objects.filter(tenant=tenant).count(), 'vlan_count': VLAN.objects.filter(tenant=tenant).count(), 'circuit_count': Circuit.objects.filter(tenant=tenant).count(), 'virtualmachine_count': VirtualMachine.objects.filter(tenant=tenant).count(),