django-enum
Full and natural support for enumerations as Django model fields.
Decision gist · record as of 2026-08-14
Yes. django-enum is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—type-safe enum storage in Django models. Use it if you want enum instances (not raw values) in your ORM, need bitfield support, or work with complex enums. The 1.x to 2.x migration is documented; review the changelog if upgrading.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with only django as a runtime dependency.
- Active maintenance with a release 14 days ago and recent commits; supports Django 4.2 through 6.1 and Python 3.10–3.14.
License · maintenance · safety
MIT (permissive) — MIT license (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-07-31 (14 days) · last repo commit 2026-08-07 · 110 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 172,356 downloads/mo, #10,339 on PyPI
Alternatives
Verify before relying
pip install django-enum
from django.db import models
from django_enum import EnumField
class MyModel(models.Model):
class Status(models.TextChoices):
ACTIVE = "A", "Active"
INACTIVE = "I", "Inactive"
status = EnumField(Status, default=Status.ACTIVE)
instance = MyModel.objects.create(status=MyModel.Status.ACTIVE)
assert instance.status == MyModel.Status.ACTIVE- Whether enum-properties integration is optional or required for complex enum support
- Performance characteristics of bitfield queries compared to multiple boolean columns in production workloads
What it is and what it does
django-enum extends Django's model layer with an EnumField that treats Python enumerations as first-class database column types. Rather than storing only the raw value (string or integer) and requiring manual conversion, EnumField automatically coerces retrieved values back to their enum type, so you work with type-safe enum instances throughout your code. It handles standard enums (TextChoices, IntegerChoices), custom Enum types, and Flag types for bitfield operations.
The package intelligently selects the smallest appropriate database column type for each enum—for example, an IntegerChoices with values 0–32767 becomes a PositiveSmallIntegerField. It integrates with Django's existing choice system, supports migrations, enforces value consistency via database check constraints, and optionally works with enum-properties for richer enumeration types with multiple symmetric properties. The library is lightweight, actively maintained, and supports modern Django (4.2–6.1) and Python (3.10–3.14) versions.
Use it for
- Store status or state enums in models and access them as typed enum instances rather than raw strings or integers
- Implement permission or feature flags using IntFlag with bitfield queries to efficiently check multiple permissions at once
- Use complex enums with enum-properties to attach rich metadata (labels, RGB values, etc.) to each enum member and query by any symmetric property
- Replace multiple boolean columns with a single Flag enum field to reduce storage and improve query performance on large tables
- Ensure database-level consistency of enum values using check constraints while maintaining clean, type-safe Python code
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
django-enum is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—type-safe enum storage in Django models. Use it if you want enum instances (not raw values) in your ORM, need bitfield support, or work with complex enums. The 1.x to 2.x migration is documented; review the changelog if upgrading.
Install
django-enum on PyPI
Before you install
Low friction: pure Python wheel with only django as a runtime dependency. Active maintenance with a release 14 days ago and recent commits; supports Django 4.2 through 6.1 and Python 3.10–3.14.
License in practice
MIT license (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install django-enum
from django.db import models
from django_enum import EnumField
class MyModel(models.Model):
class Status(models.TextChoices):
ACTIVE = "A", "Active"
INACTIVE = "I", "Inactive"
status = EnumField(Status, default=Status.ACTIVE)
instance = MyModel.objects.create(status=MyModel.Status.ACTIVE)
assert instance.status == MyModel.Status.ACTIVE
Verify before relying
- Whether enum-properties integration is optional or required for complex enum support
- Performance characteristics of bitfield queries compared to multiple boolean columns in production workloads
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedjango |
| Maintenance | Actively maintained 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 172,356 / month, #10,339 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Site ManagementTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: django_enum-2.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “python enum database column”
- django-enumProvides a Django model field type that stores Python enumerations…
- alembic-postgresql-enumExtends Alembic to automatically detect and manage PostgreSQL enum…
- alembic-autogenerate-enumsExtends Alembic's autogenerate to detect and emit PostgreSQL enum…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also django-choices-field · django-enumfields · marshmallow-enum · aenum · enum34 · django-bitfield · parse-type · django-add-default-value · django-deprecate-fields · django-colorfield