summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-12-29 16:27:49 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 20:18:46 +0100
commit7b2f2e74adb36a4334e83130f6abc2f79d395235 (patch)
tree313387ba6a6f1311b43cf5fb4f2576d2d6c4f805 /django/forms/widgets.py
parentf6acd1d271122d66de8061e75ae26137ddf02658 (diff)
Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index c4bbb7fe4f..e21dba0607 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -498,7 +498,7 @@ class CheckboxInput(Input):
value = data.get(name)
# Translate true and false strings to boolean values.
values = {'true': True, 'false': False}
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
value = values.get(value.lower(), value)
return bool(value)
@@ -671,10 +671,7 @@ class Select(ChoiceWidget):
def _choice_has_empty_value(choice):
"""Return True if the choice's value is empty string or None."""
value, _ = choice
- return (
- (isinstance(value, six.string_types) and not bool(value)) or
- value is None
- )
+ return (isinstance(value, str) and not bool(value)) or value is None
def use_required_attribute(self, initial):
"""
@@ -986,7 +983,7 @@ class SelectDateWidget(Widget):
year, month, day = None, None, None
if isinstance(value, (datetime.date, datetime.datetime)):
year, month, day = value.year, value.month, value.day
- elif isinstance(value, six.string_types):
+ elif isinstance(value, str):
if settings.USE_L10N:
try:
input_format = get_format('DATE_INPUT_FORMATS')[0]