mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 10:28:37 -06:00
feat(dcim): Add filter by location slug for Device
Introduces a TreeNodeMultipleChoiceFilter for filtering locations by slug. Enhances filtering flexibility in the Device model by supporting both ID and slug lookups. Fixes #19056
This commit is contained in:
parent
6ed41f6680
commit
c1da23f0f6
@ -1057,6 +1057,13 @@ class DeviceFilterSet(
|
||||
lookup_expr='in',
|
||||
label=_('Location (ID)'),
|
||||
)
|
||||
location = TreeNodeMultipleChoiceFilter(
|
||||
queryset=Location.objects.all(),
|
||||
field_name='location',
|
||||
lookup_expr='in',
|
||||
to_field_name='slug',
|
||||
label=_('Location (slug)'),
|
||||
)
|
||||
rack_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='rack',
|
||||
queryset=Rack.objects.all(),
|
||||
|
Loading…
Reference in New Issue
Block a user