Skip to content

Commit

Permalink
Merge pull request #4 from boilerroomtv/add_support_for_django_4
Browse files Browse the repository at this point in the history
feat: noticket - Support django 4
  • Loading branch information
Winspear authored Oct 11, 2022
2 parents 8be8459 + dee4f72 commit 03f3608
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sorted_autocomplete_m2m/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.forms import Media
from django.template import Context
from django.template.loader import get_template
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import conditional_escape
from sortedm2m.forms import SortedMultipleChoiceField, SortedCheckboxSelectMultiple

Expand Down Expand Up @@ -61,7 +61,7 @@ def _render(self, name, value, attrs=None, choices=()):
final_attrs = self.build_attrs(attrs, name=name)

# Normalize to strings
str_values = [force_text(v) for v in value]
str_values = [force_str(v) for v in value]

selected = []
unselected = []
Expand All @@ -76,9 +76,9 @@ def _render(self, name, value, attrs=None, choices=()):
label_for = ''

cb = forms.CheckboxInput(final_attrs, check_test=lambda v: v in str_values)
option_value = force_text(option_value)
option_value = force_str(option_value)
rendered_cb = cb.render(name, option_value)
option_label = conditional_escape(force_text(option_label))
option_label = conditional_escape(force_str(option_label))
item = {'label_for': label_for, 'rendered_cb': rendered_cb, 'option_label': option_label,
'option_value': option_value}
if option_value in str_values:
Expand Down

0 comments on commit 03f3608

Please sign in to comment.