Skip to content

Commit 31a4bc1

Browse files
authored
Merge pull request #12 from just495/fix/support_list_in_filter_query
fix support list in filter query
2 parents 9782c67 + 7ffc7a6 commit 31a4bc1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fastapi_rest_jsonapi/data_layers/filtering/sqlalchemy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def create_filter(self, schema_field: ModelField, model_column, operator, value)
8989
errors: List[str] = []
9090
for i_type in types:
9191
try:
92-
clear_value = i_type(value)
92+
if isinstance(value, list):
93+
clear_value = [i_type(item) for item in value]
94+
else:
95+
clear_value = i_type(value)
9396
except (TypeError, ValueError) as ex:
9497
errors.append(str(ex))
9598
# Если None, при этом поле обязательное (среди типов в аннотации нет None, то кидаем ошибку)

0 commit comments

Comments
 (0)