For any subclass E of Choices, IntegerChoices or TextChoicesE.values now has type Sequence[E] instead of list[str] (or list[int]). Similarly for E.choices. The implementation is borrowed from the typeshed implementation of enum.EnumMeta.
I’m not sure about the tests, i.e. just putting a subclass of Choices into the models module. Happy to change that.
For any subclass
E
ofChoices
,IntegerChoices
orTextChoices
E.values
now has typeSequence[E]
instead oflist[str]
(orlist[int]
). Similarly forE.choices
. The implementation is borrowed from the typeshed implementation ofenum.EnumMeta
.I’m not sure about the tests, i.e. just putting a subclass of
Choices
into the models module. Happy to change that.