mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Annotate rack search queryset with device count
This commit is contained in:
parent
58e4d08bb0
commit
a84ae88214
@ -65,7 +65,9 @@ DCIM_TYPES = OrderedDict(
|
||||
'url': 'dcim:site_list',
|
||||
}),
|
||||
('rack', {
|
||||
'queryset': Rack.objects.prefetch_related('site', 'location', 'tenant', 'role'),
|
||||
'queryset': Rack.objects.prefetch_related('site', 'location', 'tenant', 'role').annotate(
|
||||
device_count=count_related(Device, 'rack')
|
||||
),
|
||||
'filterset': RackFilterSet,
|
||||
'table': RackTable,
|
||||
'url': 'dcim:rack_list',
|
||||
|
Loading…
Reference in New Issue
Block a user