skillfed

django-enumfields

Real Python Enums for Django.

django-enumfields v2.1.1 132.8K downloads/30d#11,536 on PyPI146
Permissive license MIT Abandoned released

What it is and what it does

django-enumfields bridges Python's standard enum module (PEP 435) with Django's ORM by providing EnumField and EnumIntegerField model fields that store enum values in the database while preserving type safety in Python code. It includes a custom Enum class that auto-generates human-readable labels for use in admin dropdowns and forms, plus integration with Django's admin list filters and Django REST Framework serializers.

The package is straightforward to use: define a Python enum, attach it to a model field, and query using enum members directly rather than raw strings or integers. It handles form field generation and admin integration automatically. However, the project is no longer maintained—the last release was in February 2021 and the last repository commit in December 2022—so it may not work reliably with newer Django or Python versions.

Use it for:

  • Store categorical data (e.g., status, color, priority) in Django models with type-safe enum access instead of magic strings.
  • Generate admin dropdown filters automatically from enum definitions without manual choice tuples.
  • Serialize enum fields in Django REST Framework APIs while preserving enum semantics in the JSON output.
  • Use enums in model queries and filters with IDE autocomplete and static type checking.
  • Define custom labels for enum values in admin and form displays via a nested Labels class.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Django model fields that store Python enums natively, allowing you to use PEP 435-style enums in models, forms, and admin interfaces with automatic label generation.

No—unless you are locked into Django 2.2, 3.0, or 3.1 with Python 3.5–3.9 and have no plans to upgrade. The package is abandoned and has not been updated since 2021. Compatibility with newer versions is unverified. For new projects, consider using Django's native choices with enums or a maintained alternative.

Install

django-enumfields on PyPI

pip

pip install django-enumfields

uv

uv add django-enumfields

poetry

poetry add django-enumfields

Installing django-enumfields

Before you install

Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2021-02-23 and last commit 2022-12-20, with no active maintenance. Use only if your Django and Python versions align with the supported range.

License in practice

MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects.

Quickstart

pip install django-enumfields

from enumfields import EnumField
from enum import Enum

class Color(Enum):
    RED = 'r'
    GREEN = 'g'

class MyModel(models.Model):
    color = EnumField(Color, max_length=1)

m = MyModel.objects.filter(color=Color.RED)

Requires Django 2.2, 3.0, or 3.1 and Python 3.5–3.9; compatibility with newer versions is unverified due to abandonment.

Verify before relying

  • Whether the package works with Django versions released after 3.1
  • Whether the package works with Python versions released after 3.9
  • Current state of DRF integration with modern rest_framework versions
  • Whether abandonment has led to incompatibilities with current dependency versions

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,998 days since the last release
Last repo commit
First released
Downloads 132,797/month — #11,536 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_enumfields-2.1.1-py3-none-any.whl

Environment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP

Tags

django enum fieldpython enum django modelenum storage djangodjango admin enum filterenum form field djangodrf enum serializerdjango enumintegerfield
django-ormenum-supportabandoned

More WWW/HTTP packages