py3: convert encode query to text (#44464)

This commit is contained in:
Serghei Mihai 2020-06-26 00:37:38 +02:00
parent fb51303820
commit 300812c3b8
1 changed files with 2 additions and 1 deletions

View File

@ -149,9 +149,10 @@ class VoiesView(View, SingleObjectMixin):
voies.append({'id': voie, 'text': prefix_cleanup(voie)})
if 'q' in request.GET and request.GET['q']:
q = force_text(request.GET['q']).upper()
q = request.GET['q'].upper()
q = q.replace("'", ' ')
q = unicodedata.normalize('NFKD', q).encode('ascii', 'ignore')
q = force_text(q)
voies = [v for v in voies if q in v['text']]
voies.sort(key=lambda x: x['id'])