diff --git a/apis_core/relations/filtersets.py b/apis_core/relations/filtersets.py index f667a5e9a..e545d20eb 100644 --- a/apis_core/relations/filtersets.py +++ b/apis_core/relations/filtersets.py @@ -30,8 +30,10 @@ def _search_all_entities(self, value) -> list[str]: return RootObject.objects_inheritance.filter(q).values_list("pk", flat=True) def filter(self, qs, value): - all_entities = self._search_all_entities(value) - return qs.filter(**{f"{self.field_name}_object_id__in": all_entities}) + if value: + all_entities = self._search_all_entities(value) + return qs.filter(**{f"{self.field_name}_object_id__in": all_entities}) + return qs class SubjObjClassFilter(MultipleChoiceFilter):