Skip to content

Commit

Permalink
fix(relations): only filter queryset if there is actually a value
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Dec 11, 2024
1 parent 4694885 commit 7cd93e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apis_core/relations/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 7cd93e7

Please sign in to comment.