mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-17 06:29:53 +02:00
Fixes #21531: Fix search functionality for location when combined with other filters
This commit is contained in:
@@ -306,12 +306,9 @@ class LocationFilterSet(TenancyFilterSet, ContactModelFilterSet, NestedGroupMode
|
|||||||
fields = ('id', 'name', 'slug', 'facility', 'description')
|
fields = ('id', 'name', 'slug', 'facility', 'description')
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
# extended in order to include querying on Location.facility
|
# Extend `search()` to include querying on Location.facility
|
||||||
queryset = super().search(queryset, name, value)
|
|
||||||
|
|
||||||
if value.strip():
|
if value.strip():
|
||||||
queryset = queryset | queryset.model.objects.filter(facility__icontains=value)
|
return super().search(queryset, name, value) | queryset.filter(facility__icontains=value)
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user