Skip to content

Commit

Permalink
💚 [#472] fix new filter field widget
Browse files Browse the repository at this point in the history
  • Loading branch information
annashamray committed Dec 12, 2024
1 parent 12635f3 commit 3676052
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/objects/tests/v2/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ def test_filter_two_icontains_with_comma(self):
)



class FilterDateTests(TokenAuthMixin, APITestCase):
@classmethod
def setUpTestData(cls):
Expand Down
4 changes: 4 additions & 0 deletions src/objects/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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

0 comments on commit 3676052

Please sign in to comment.