Skip to content

Commit

Permalink
fix: remove deprecated force_text
Browse files Browse the repository at this point in the history
`force_text` was an alias of `force_str` in <=Django3.2, but was removed
in Django 4.0.
  • Loading branch information
eivindkopperud committed Mar 18, 2022
1 parent a9f214f commit 6e1c5af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions enumchoicefield/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.forms.fields import Field
from django.forms.utils import flatatt
from django.forms.widgets import Widget
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import format_html, mark_safe
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -34,7 +34,7 @@ def render(self, name, value, attrs=None, renderer=None):
return mark_safe('\n'.join(output))

def render_options(self, selected_choices):
selected_choices = set(map(force_text, selected_choices))
selected_choices = set(map(force_str, selected_choices))
options = []
if not self.is_required:
options.append(self.render_option(selected_choices, None))
Expand All @@ -48,7 +48,7 @@ def render_option(self, selected_choices, option):
option_label = '---------'
else:
option_value = option.name
option_label = force_text(option)
option_label = force_str(option)

attrs = {'value': option_value}
if option_value in selected_choices:
Expand Down

0 comments on commit 6e1c5af

Please sign in to comment.