Skip to content

Commit

Permalink
Optimized containment check in ChoicesMeta.
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-RR authored and felixxm committed Dec 16, 2019
1 parent 9d40b6b commit 972d93a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django/db/models/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __new__(metacls, classname, bases, classdict):
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
Expand Down

0 comments on commit 972d93a

Please sign in to comment.