From 23a27f2c03afddba7076d7f491fe8391c2931e3e Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Fri, 8 Dec 2017 08:14:25 +0500 Subject: [PATCH] Simplified widgets.Select._choice_has_empty_value(). --- django/forms/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index c758b36e91..ba8287cd97 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 value) or value is None + return value is None or value == '' def use_required_attribute(self, initial): """