mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Implement support for nested TenantGroups
This commit is contained in:
@@ -20,7 +20,13 @@ from .models import Tenant, TenantGroup
|
||||
|
||||
class TenantGroupListView(PermissionRequiredMixin, ObjectListView):
|
||||
permission_required = 'tenancy.view_tenantgroup'
|
||||
queryset = TenantGroup.objects.annotate(tenant_count=Count('tenants'))
|
||||
queryset = TenantGroup.objects.add_related_count(
|
||||
TenantGroup.objects.all(),
|
||||
Tenant,
|
||||
'group',
|
||||
'tenant_count',
|
||||
cumulative=True
|
||||
)
|
||||
table = tables.TenantGroupTable
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user