diff --git a/src/objects/tests/v2/test_filters.py b/src/objects/tests/v2/test_filters.py index 684b3da8..19c714fe 100644 --- a/src/objects/tests/v2/test_filters.py +++ b/src/objects/tests/v2/test_filters.py @@ -500,7 +500,6 @@ def test_filter_two_icontains_with_comma(self): ) - class FilterDateTests(TokenAuthMixin, APITestCase): @classmethod def setUpTestData(cls): diff --git a/src/objects/utils/filters.py b/src/objects/utils/filters.py index 14555b76..0f19187c 100644 --- a/src/objects/utils/filters.py +++ b/src/objects/utils/filters.py @@ -53,6 +53,9 @@ class ObjectTypeFilter(URLModelChoiceFilter): class ManyWidget(forms.Widget): def value_from_datadict(self, data, files, name): + if name not in data: + return [] + return data.getlist(name) @@ -69,4 +72,5 @@ def to_python(self, value): class ManyCharFilter(filters.CharFilter): # django-filter doesn't support several uses of the same query param out of the box + # so we need to do it ourselves field_class = ManyCharField