summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-11 19:47:36 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-11 19:49:38 +0100
commit92866682c6b4bd4f2ec67d6c6596e8c85585a4fd (patch)
tree3d2d156dd0c458e606f9ddc04c11c3f707b9b757 /django/db
parent16297e7d5e3a6b0287d114e95d1d544995618c93 (diff)
[3.0.x] 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. Backport of 6f7998adc784032f4b8918ca2eea27537ea4cbbe from master
Diffstat (limited to 'django/db')
-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 37b0045ef3..e8a65c541d 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -272,10 +272,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