A Django field that directly sets/gets Django's TextChoices/IntegerChoices enum values, eliminating manual conversion between enum members and database values. Version 4.0.0 requires Python >=3.10, Django <4.0, and drops support for Python 3.8/3.9. Released irregularly, with breaking changes in v4.0.0 including strict blank/null validation and type checking utilities.
pip install django-choices-fieldVerified import paths — ran on the pinned version, not inferred.
Define a model with a ChoicesField using Django's TextChoices enum.
Always set null=True when blank=True, or omit blank=True if not needed.
Define a ChoicesEnum subclass and pass it to the choices_enum parameter.
Upgrade to >=3.1.1, or manually override get_FIELD_display() if stuck on older version.
Provide a default argument (e.g., default=MyEnum.FOO) or set null=True and/or blank=True.