From 2b81faab257832d3dbd42947a884f7ec99685d18 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 7 Dec 2017 17:13:07 -0500 Subject: Fixed #28906 -- Removed unnecessary bool() calls. --- django/forms/forms.py | 2 +- django/forms/widgets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'django/forms') diff --git a/django/forms/forms.py b/django/forms/forms.py index e2e7c645ff..a43f80996b 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -139,7 +139,7 @@ class BaseForm: if self._errors is None: is_valid = "Unknown" else: - is_valid = self.is_bound and not bool(self._errors) + is_valid = self.is_bound and not self._errors return '<%(cls)s bound=%(bound)s, valid=%(valid)s, fields=(%(fields)s)>' % { 'cls': self.__class__.__name__, 'bound': self.is_bound, diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 498185fe23..c758b36e91 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -681,7 +681,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, str) and not bool(value)) or value is None + return (isinstance(value, str) and not value) or value is None def use_required_attribute(self, initial): """ -- cgit v1.3