You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
) the QueryArrayWidget should work with the foo=bar,baz syntax. It does however test for this syntax by testing for MultiValueDict.
The problem here is that a QueryDict (the actual data type) is a subclass of MultiValueDict and the result always returns False and the data never get into the if statement.
I fixed it by replacing the code with:
if not type(data) == MultiValueDict:
data = data.copy()
ret = {}
for key, value in data.items():
if type(value) == list:
value = list[0]
# treat value as csv string: ?foo=1,2
if isinstance(value, str):
ret[key] = [x.strip() for x in value.rstrip(",").split(",") if x]
data = MultiValueDict(ret)
But I'm sure there must be a better fix.
The text was updated successfully, but these errors were encountered:
Ok, so the first port of call is a failing test case demonstrating the issue, and then we can look at whether the fix is optimal, or if we can find a better one.
According to the docs (
django-filter/django_filters/widgets.py
Line 240 in 4a3eb8b
The problem here is that a QueryDict (the actual data type) is a subclass of MultiValueDict and the result always returns False and the data never get into the if statement.
I fixed it by replacing the code with:
But I'm sure there must be a better fix.
The text was updated successfully, but these errors were encountered: