P
P
pzverr2014-11-06 13:39:00
Django
pzverr, 2014-11-06 13:39:00

How to solve the problem of Cyrillic in url?

Good afternoon!
Installed Django-filter, filter forms work fine, but as soon as you change the display method from forms to AllValuesFilter, everything collapses here is an error:
197d4561de7e4b8a9b7539e630b6344b.png
But if the query string is not empty, but something like www.your-url.com/catalog/printer?printer_type= then it is displayed all OK.
I decided to go to the django-filter sources and changed the line from url = urlencode(data) to url = data, everything seemed to work, but this is not an option, because the url becomes scary :) because data is a json object as I understand it.
Another thing is strange, when there are no parameters in the URL, then for some reason the data parameter is not empty, it contains the following information:
b9015aaabf2f4ec69aa0804b90561dc5.png
Point me to the right path, maybe something needs to be changed in the PrinterFilter class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2014-11-06
@alternativshik

before passing data to the filter, try doing .decode('utf-8') or encode )))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question