diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-04-21 19:52:26 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-04-27 09:10:02 +0200 |
| commit | 301de774c21d055e9e5a7073e5bffdb52bc71079 (patch) | |
| tree | 4c0c65fd147d528cce920cbd6a16ffa493d832ca /django/forms/widgets.py | |
| parent | 8ab7ce8558792f41637d6f87f2a8a117e169dd18 (diff) | |
Refs #27795 -- Replaced many force_text() with str()
Thanks Tim Graham for the review.
Diffstat (limited to 'django/forms/widgets.py')
| -rw-r--r-- | django/forms/widgets.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 04f800785b..2feded85c7 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -12,7 +12,6 @@ from django.forms.utils import to_current_timezone from django.templatetags.static import static from django.utils import datetime_safe, formats from django.utils.dates import MONTHS -from django.utils.encoding import force_text from django.utils.formats import get_format from django.utils.html import format_html, html_safe from django.utils.safestring import mark_safe @@ -184,7 +183,7 @@ class Widget(metaclass=MediaDefiningClass): return None if self.is_localized: return formats.localize_input(value) - return force_text(value) + return str(value) def get_context(self, name, value, attrs): context = {} @@ -483,7 +482,7 @@ class CheckboxInput(Input): """Only return the 'value' attribute if value isn't empty.""" if value is True or value is False or value is None or value == '': return - return force_text(value) + return str(value) def get_context(self, name, value, attrs): if self.check_test(value): @@ -570,7 +569,7 @@ class ChoiceWidget(Widget): for subvalue, sublabel in choices: selected = ( - force_text(subvalue) in value and + str(subvalue) in value and (not has_selected or self.allow_multiple_selected) ) if selected and not has_selected: |
