Closes #1824: Add virtual machine count to platforms list

This commit is contained in:
Jeremy Stretch
2018-01-19 09:25:16 -05:00
parent d5ecfe7bef
commit 7ac27b59c6
2 changed files with 11 additions and 4 deletions

View File

@@ -754,7 +754,10 @@ class DeviceRoleBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
#
class PlatformListView(ObjectListView):
queryset = Platform.objects.annotate(device_count=Count('devices'))
queryset = Platform.objects.annotate(
device_count=Count('devices', distinct=True),
vm_count=Count('virtual_machines', distinct=True)
)
table = tables.PlatformTable
template_name = 'dcim/platform_list.html'