-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using MultiValueDict breaks LinkWidget #1689
Comments
Hmmm. Prior to the change the default was a
i.e. |
I don't fully understand your comment, but just in case: The problem is not the django-filter/django_filters/widgets.py Lines 59 to 65 in 3656174
Urlencode then encodes the lists which MultiValueDict returns as their string-representation (as seen in the test output) |
|
Ok, so we'll likely have to cast to a dict there. The data should be a multidict, so LinkWidget should handle that. Good spot. Fancy making a PR with the regression test and tweak? |
#1634 introduced using a
MultiValueDict
as the default empty value for the form data. This however broke using LinkWidget. If the FilterSet is initialised with a false-ydata
attribute, theFilterSet
s data attribute is set to an emptyMultiValueDict
. This gets passed toLinkWidget
svalue_from_datadict
, which then sets itsself.data
attribute to it. This leads toLinkWidget.render_option
passing aMultiValueDict
todjango.utils.http.urlencode
which then renders the option values as lists (?price=%5B%27test-val1%27%5D
, i.e.?price=['test-val1']
, instead of?price=test-val1
for an empty option in the example below).fails as follows:
The text was updated successfully, but these errors were encountered: