diff options
| author | Ram Rachum <ram@rachum.com> | 2019-12-16 12:22:45 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-16 11:22:45 +0100 |
| commit | 972d93a95ec8b37fab84400417070b7439414967 (patch) | |
| tree | 678e381dcd96a0a577ff5893b35e8784cb40fd88 | |
| parent | 9d40b6bbf44d0de4d446dde5b9b51cadb60a24a3 (diff) | |
Optimized containment check in ChoicesMeta.
| -rw-r--r-- | django/db/models/enums.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/enums.py b/django/db/models/enums.py index ae20ef6d93..f48143ddaf 100644 --- a/django/db/models/enums.py +++ b/django/db/models/enums.py @@ -36,7 +36,7 @@ class ChoicesMeta(enum.EnumMeta): def __contains__(cls, member): if not isinstance(member, enum.Enum): # Allow non-enums to match against member values. - return member in {x.value for x in cls} + return any(x.value == member for x in cls) return super().__contains__(member) @property |
