Skip to content

Commit

Permalink
Feature to support 'in' clause based on jsonapi filter=1,2,3 - BUG: m…
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenghio committed Jun 5, 2020
1 parent b44bc08 commit 6c90beb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions flask_rest_jsonapi/querystring.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,17 @@ def _get_key_values(self, name):
return results

def _simple_filters(self, dict_):
return [{"name": key, "op": "eq", "val": value}
for (key, value) in dict_.items()]
"""Return filter list
:return list: list of dict for filter parameters. Includes support for 'in' for list values
"""
filter_list = []
for (key, value) in dict_.items():
operator = 'eq'
if isinstance(value, list):
operator = 'in'
filter_list.append({"name": key, "op": operator, "val": value})
return filter_list

@property
def querystring(self):
Expand Down

0 comments on commit 6c90beb

Please sign in to comment.