diff options
| author | Tim Graham <timograham@gmail.com> | 2017-12-07 17:13:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-07 17:13:07 -0500 |
| commit | 2b81faab257832d3dbd42947a884f7ec99685d18 (patch) | |
| tree | f6fbaefb4284567bcd0a0e2a27a6ce36938aaef3 /django/forms | |
| parent | 02d9419fe34eaa4d41d8a8df93373f286a36a2ae (diff) | |
Fixed #28906 -- Removed unnecessary bool() calls.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/forms.py | 2 | ||||
| -rw-r--r-- | django/forms/widgets.py | 2 |
2 files changed, 2 insertions, 2 deletions
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): """ |
