Tutorials

Enumerations in Python can provide rich class based interfaces well suited to many use cases. We present several real world scenarios here that demonstrate the capability of django-enum to get your EnumField to do more work.

In the properties tutorial, we leverage Enum Properties to encapsulate more information onto our Enum values so that any information needed in different contexts is readily available without brittle mapping boilerplate. We also demonstrate symmetric properties that are comparison equivalent to our enumeration values.

In the flags tutorial, we demonstrate how to use enum.Flag enumerations to represent bitfields in a database. This is a common pattern for storing multiple boolean values in a single column.