diff options
| author | Adam Johnson <me@adamj.eu> | 2020-01-09 15:41:54 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-10 07:52:06 +0100 |
| commit | 5166097d7c80cab757e44f2d02f3d148fbbc2ff6 (patch) | |
| tree | 212330fa1fee4064945231b9523eb8cfa64a4b41 /django | |
| parent | 4c1b401e8250f9f520b3c7dc369554477ce8b15a (diff) | |
Fixed #31154 -- Added support for using enumeration types in templates.
Enumeration helpers are callables, so the template system tried to call
them with no arguments.
Thanks Rupert Baker for helping discover this.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/enums.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/django/db/models/enums.py b/django/db/models/enums.py index f48143ddaf..51821a2b45 100644 --- a/django/db/models/enums.py +++ b/django/db/models/enums.py @@ -31,6 +31,7 @@ class ChoicesMeta(enum.EnumMeta): # that is passed in as "self" as the value to use when looking up the # label in the choices. cls.label = property(lambda self: cls._value2label_map_.get(self.value)) + cls.do_not_call_in_templates = True return enum.unique(cls) def __contains__(cls, member): |
