Skip to content

Commit

Permalink
fix 🔧 resolve filters not hashable error
Browse files Browse the repository at this point in the history
  • Loading branch information
samar-hassan committed Apr 23, 2024
1 parent a5eb737 commit 6ccf4f5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions oscar_odin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@


def get_filters(instances, field_names):
filters = []
for ui in instances:
klaas = {}
for field_name in field_names:
field_value = getattr(ui, field_name)
klaas[field_name] = field_value

yield Q(**klaas)
if field_value not in filters:
filters.append(field_value)
klaas[field_name] = field_value
if klaas:
yield Q(**klaas)


def get_query(instances, field_names):
filters = set((get_filters(instances, field_names)))
filters = list((get_filters(instances, field_names)))

query = filters.pop()
for query_filter in filters:
Expand Down

0 comments on commit 6ccf4f5

Please sign in to comment.