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:
@@ -16,7 +16,7 @@ class TenantAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields = {
|
||||
'slug': ['name'],
|
||||
}
|
||||
list_display = ['name', 'slug', 'group']
|
||||
list_display = ['name', 'slug', 'group', 'description']
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(TenantAdmin, self).get_queryset(request)
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user