Fixes #21531: Fix search functionality for location when combined with other filters (#21599)
CodeQL / Analyze (actions) (push) Failing after 5s
CI / build (20.x, 3.12) (push) Failing after 20s
CodeQL / Analyze (javascript-typescript) (push) Failing after 4s
CI / build (20.x, 3.13) (push) Failing after 15s
CodeQL / Analyze (python) (push) Failing after 3s
CI / build (20.x, 3.14) (push) Failing after 14s

This commit is contained in:
Jeremy Stretch
2026-03-06 12:54:10 -05:00
committed by GitHub
parent cca4cc61b6
commit 67defb3228
+2 -5
View File
@@ -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