diff --git a/src/ralph/dashboards/filter_parser.py b/src/ralph/dashboards/filter_parser.py index b4a85068cb..e2f4f88c36 100644 --- a/src/ralph/dashboards/filter_parser.py +++ b/src/ralph/dashboards/filter_parser.py @@ -11,6 +11,8 @@ class FilterParser(object): + or_sep = ',' + def __init__(self, queryset, filters_dict, exclude_mode=False): self.filters = filters_dict if exclude_mode: @@ -40,7 +42,8 @@ def _filter_operator(self, key, value, op): return reduce(op, [Q(**{key: v}) for v in value]) def filter_or(self, key, value): - return [self._filter_operator(key, value, operator.or_)], {} + norm_val = value.split(self.or_sep) + return [self._filter_operator(key, norm_val, operator.or_)], {} def filter_and(self, key, value): return [self._filter_operator(key, value, operator.and_)], {} diff --git a/src/ralph/dashboards/tests/test_parser.py b/src/ralph/dashboards/tests/test_parser.py index 1323088583..4663b825e4 100644 --- a/src/ralph/dashboards/tests/test_parser.py +++ b/src/ralph/dashboards/tests/test_parser.py @@ -48,7 +48,7 @@ def test_process_value(self, value, expect): (['1'], Q(key='1')), (['1', '2'], Q(key='1') & Q(key='2')), ) - def test_process_value(self, value, expect): + def test_process_value_as_list(self, value, expect): result = self.parser.filter_and('key', value) self.assertEqual(str(result[ARGS][0]), str(expect))