Skip to content

Commit

Permalink
fix: fix #424, really push OR, AND and NOT to the end (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral authored Dec 6, 2023
1 parent 518fd8e commit 503dd5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion strawberry_django/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def build_filter_kwargs(
# This loop relies on the filter field order: AND, OR, and NOT fields are expected to be last. Since this is not
# true in case of filter inheritance, we need to explicitely sort them.
for f in sorted(
filters.__strawberry_definition__.fields, key=lambda f: f.name, reverse=True
filters.__strawberry_definition__.fields,
key=lambda f: f.name in {"AND", "OR", "NOT"},
):
field_name = f.name
field_value = _resolve_global_id(getattr(filters, field_name))
Expand Down

0 comments on commit 503dd5e

Please sign in to comment.