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

Closes #1137: Allow filtering devices list by rack

This commit is contained in:
Jeremy Stretch
2017-05-12 22:41:27 -04:00
parent ab30ba1e1b
commit d11dfe2ced
2 changed files with 68 additions and 5 deletions

View File

@ -814,6 +814,10 @@ class DeviceFilterForm(BootstrapMixin, CustomFieldFilterForm):
queryset=RackGroup.objects.select_related('site').annotate(filter_count=Count('racks__devices')),
label='Rack group',
)
rack_id = FilterChoiceField(
queryset=Rack.objects.annotate(filter_count=Count('devices')),
label='Rack',
)
role = FilterChoiceField(
queryset=DeviceRole.objects.annotate(filter_count=Count('devices')),
to_field_name='slug',