Skip to content

Commit 3676052

Browse files
committed
💚 [#472] fix new filter field widget
1 parent 12635f3 commit 3676052

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/objects/tests/v2/test_filters.py

-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ def test_filter_two_icontains_with_comma(self):
500500
)
501501

502502

503-
504503
class FilterDateTests(TokenAuthMixin, APITestCase):
505504
@classmethod
506505
def setUpTestData(cls):

src/objects/utils/filters.py

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class ObjectTypeFilter(URLModelChoiceFilter):
5353

5454
class ManyWidget(forms.Widget):
5555
def value_from_datadict(self, data, files, name):
56+
if name not in data:
57+
return []
58+
5659
return data.getlist(name)
5760

5861

@@ -69,4 +72,5 @@ def to_python(self, value):
6972

7073
class ManyCharFilter(filters.CharFilter):
7174
# django-filter doesn't support several uses of the same query param out of the box
75+
# so we need to do it ourselves
7276
field_class = ManyCharField

0 commit comments

Comments
 (0)