Enum classes

class enumchoicefield.enum.PrettyEnum

A PrettyEnum makes defining nice, human-readable names for enum members easy. To use it, subclass PrettyEnum and declare the enum members with their human-readable name as their value:

class Fruit(PrettyEnum):
    apple = "Apple"
    banana = "Banana"
    orange = "Orange"

The members’ values will be automatically set to ascending integers, starting at one. In the example above, Fruit.apple.value is 1, and Fruit.orange.value is 3.

class enumchoicefield.enum.DeconstructableEnum
deconstruct()

a DeconstructableEnum defines deconstruct(), compatible with Django migrations. If you want to set a default for an EnumChoiceField, the enum must be deconstructable.

class enumchoicefield.enum.ChoiceEnum

a ChoiceEnum extends both PrettyEnum and DeconstructableEnum. It is recommended to use a ChoiceEnum subclass with EnumChoiceField, but this is not required.