diff options
| author | Tim Graham <timograham@gmail.com> | 2018-05-29 21:43:38 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-05-29 21:43:56 -0400 |
| commit | 4ca64f2bd52dea691e33473dc97f8ee9e2a1130d (patch) | |
| tree | df4054e60bed4c0a0e2fb9599c946f7aea5dcf59 /django/db/models/fields/__init__.py | |
| parent | 25d4d8465b5a92cae5647117e2a42f71cd97a06f (diff) | |
[2.1.x] Refs #28748 -- Reallowed lazy model field choices.
Regression in 3aa9ab39cce6b2a27d6334ad0148c8f37b6f5986.
Backport of c03e41712b2274f524d32bc2aef455ed82c9e3b4 from master
Diffstat (limited to 'django/db/models/fields/__init__.py')
| -rw-r--r-- | django/db/models/fields/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index f21a6df7f7..50d22bef0c 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -244,10 +244,10 @@ class Field(RegisterLookupMixin): if not self.choices: return [] - def is_value(value): - return isinstance(value, (str, Promise)) or not is_iterable(value) + def is_value(value, accept_promise=True): + return isinstance(value, (str, Promise) if accept_promise else str) or not is_iterable(value) - if is_value(self.choices): + if is_value(self.choices, accept_promise=False): return [ checks.Error( "'choices' must be an iterable (e.g., a list or tuple).", |
