Skip to content

Commit

Permalink
fix #120: Add support for UTF-8 characters in IncompleteSelectMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Mar 26, 2024
1 parent bde4b42 commit 184c7a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions formset/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django.db.models.query_utils import Q
from django.forms.models import ModelChoiceIterator, ModelChoiceIteratorValue
from django.forms.widgets import DateTimeBaseInput, FileInput, Select, SelectMultiple, TextInput, Widget
from django.utils.encoding import uri_to_iri
from django.utils.timezone import datetime, now
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -108,6 +109,7 @@ def build_filter_query(self, filters):
raise ImproperlyConfigured(f"Invalid attribute 'filter_by' in {self.__class__}.")

def build_search_query(self, search_term):
search_term = uri_to_iri(search_term)
try:
return reduce(or_, (Q(**{sl: search_term}) for sl in self.search_lookup))
except TypeError:
Expand Down
9 changes: 9 additions & 0 deletions testapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ def initialize_opinions(apps, schema_editor):
for counter in range(1, 3000):
label = f"Opinion {counter:04}"
OpinionModel.objects.create(tenant=1, label=label)
for counter in range(1, 500):
label = f"Übung {counter:04}"
OpinionModel.objects.create(tenant=1, label=label)
for counter in range(1, 500):
label = f"Оптион {counter:04}"
OpinionModel.objects.create(tenant=1, label=label)
for counter in range(1, 500):
label = f"επιλογή {counter:04}"
OpinionModel.objects.create(tenant=1, label=label)


def initialize_counties(apps, schema_editor):
Expand Down

0 comments on commit 184c7a1

Please sign in to comment.