1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Added stats to tenant view

This commit is contained in:
Jeremy Stretch
2016-07-27 11:56:47 -04:00
parent 2abee211a2
commit e4960873f3
3 changed files with 45 additions and 5 deletions

View File

@@ -50,7 +50,14 @@ class TenantListView(ObjectListView):
def tenant(request, slug):
tenant = get_object_or_404(Tenant, slug=slug)
tenant = get_object_or_404(Tenant.objects.annotate(
site_count=Count('sites', distinct=True),
rack_count=Count('racks', distinct=True),
device_count=Count('devices', distinct=True),
vrf_count=Count('vrfs', distinct=True),
vlan_count=Count('vlans', distinct=True),
circuit_count=Count('circuits', distinct=True),
), slug=slug)
return render(request, 'tenancy/tenant.html', {
'tenant': tenant,