diff --git a/zou/app/blueprints/crud/base.py b/zou/app/blueprints/crud/base.py index fe615c1b30..887cb502d8 100644 --- a/zou/app/blueprints/crud/base.py +++ b/zou/app/blueprints/crud/base.py @@ -79,7 +79,11 @@ def build_filters(self, options): ) and isinstance( field_key.property, orm.properties.RelationshipProperty ) - value_is_list = len(value) > 0 and value[0] == "[" + value_is_list = ( + hasattr(value, "__len__") + and len(value) > 0 + and value[0] == "[" + ) if key == "name" and field_key is not None: name_filter.append(value) diff --git a/zou/app/utils/query.py b/zou/app/utils/query.py index 062a48ef41..f78de28775 100644 --- a/zou/app/utils/query.py +++ b/zou/app/utils/query.py @@ -40,7 +40,11 @@ def apply_criterions_to_db_query(model, db_query, criterions): ) and isinstance( field_key.property, orm.properties.RelationshipProperty ) - value_is_list = len(value) > 0 and value[0] == "[" + value_is_list = ( + hasattr(value, "__len__") + and len(value) > 0 + and value[0] == "[" + ) if key == "name" and field_key is not None: name_filter.append(value)