summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-11 19:47:36 +0100
committerGitHub <noreply@github.com>2020-01-11 19:47:36 +0100
commit6f7998adc784032f4b8918ca2eea27537ea4cbbe (patch)
tree889c4cfe595c3ac70ed91664824d4f16c0943014 /django
parent8b3e714ecf409ed6c9628c3f2a4e033cbfa4253b (diff)
Fixed #31155 -- Fixed a system check for the longest choice when a named group contains only non-string values.
Regression in b6251956b69512bf230322bd7a49b629ca8455c6. Thanks Murat Guchetl for the report.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index aa21a151bc..1a55d3d417 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -269,10 +269,10 @@ class Field(RegisterLookupMixin):
):
break
if self.max_length is not None and group_choices:
- choice_max_length = max(
+ choice_max_length = max([
choice_max_length,
*(len(value) for value, _ in group_choices if isinstance(value, str)),
- )
+ ])
except (TypeError, ValueError):
# No groups, choices in the form [value, display]
value, human_name = group_name, group_choices