django-bitfield
BitField in Django
Decision gist · record as of 2026-08-14
Yes, if you use PostgreSQL and need to store multiple boolean flags efficiently in Django models. The package is actively maintained, has no known vulnerabilities, and low install friction. However, verify the license before use and confirm PostgreSQL compatibility with your deployment. Not suitable for SQLite or MySQL projects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PostgreSQL; SQLite does not support save operations using Bit, and MySQL fails on most BitField queries.
- Django >= 1.11 required.
- Low friction installation with a single dependency on Django.
License · maintenance · safety
(unclear) — License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in proprietary or restricted contexts.
last release 2026-08-02 (12 days) · last repo commit 2026-08-02 · 383 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 216,818 downloads/mo, #9,371 on PyPI
Alternatives
Verify before relying
pip install django-bitfield
from bitfield import BitField
class MyModel(models.Model):
flags = BitField(flags=('awesome_flag', 'flaggy_foo'))
o = MyModel.objects.create(flags=0)
if o.flags.awesome_flag:
print('Flag is set')- Exact Python version requirements (requires_python is unspecified in metadata)
- Whether the package is compatible with the latest Django LTS versions
- Performance characteristics when dealing with large numbers of flags
What it is and what it does
django-bitfield adds a BitField model field to Django that packs multiple boolean flags into a single database BigIntegerField (stored as BIGINT). Instead of creating separate boolean columns for each flag, you define them once in the field definition and then query and manipulate them using familiar Django ORM syntax—bitwise operations, filtering, and exclusion all work through the standard QuerySet API.
The package includes admin integration via a checkbox widget and list filter, making it easy to manage flags in Django's admin interface. It's designed for PostgreSQL; SQLite and MySQL have significant limitations. The field stores flags efficiently and allows you to test, set, and clear individual flags or combinations of flags using intuitive Python syntax on model instances.
Use it for
- Store user permissions or feature flags in a single database column instead of many boolean columns
- Implement role-based access control where each role is a bit in a flags field
- Track feature toggles or configuration states for A/B testing or gradual rollouts
- Query models by multiple flag combinations efficiently using bitwise filtering
- Manage admin UI for flag-based settings using the built-in checkbox widget
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use PostgreSQL and need to store multiple boolean flags efficiently in Django models.
The package is actively maintained, has no known vulnerabilities, and low install friction. However, verify the license before use and confirm PostgreSQL compatibility with your deployment. Not suitable for SQLite or MySQL projects.
Install
django-bitfield on PyPI
Before you install
Low friction installation with a single dependency on Django. Actively maintained as of 2026-08-02 with recent Python 3.14 support added. Repository shows 383 stars and no archived status.
Requires PostgreSQL; SQLite does not support save operations using Bit, and MySQL fails on most BitField queries. Django >= 1.11 required.
License in practice
License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in proprietary or restricted contexts.
Quickstart
pip install django-bitfield
from bitfield import BitField
class MyModel(models.Model):
flags = BitField(flags=('awesome_flag', 'flaggy_foo'))
o = MyModel.objects.create(flags=0)
if o.flags.awesome_flag:
print('Flag is set')
Verify before relying
- Exact Python version requirements (requires_python is unspecified in metadata)
- Whether the package is compatible with the latest Django LTS versions
- Performance characteristics when dealing with large numbers of flags
Package facts
| License | Not declared unclear |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageDjango |
| Maintenance | Actively maintained 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 216,818 / month, #9,371 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: DjangoIntended Audience :: DevelopersIntended Audience :: System AdministratorsOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development |
Evidence: django_bitfield-2.4.0-py2.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 › “django bitfield flags”
- django-bitfieldProvides a BitField model field for Django that stores multiple…
- django-enumProvides a Django model field type that stores Python enumerations…
- django-flagsDjango-Flags provides a feature flag system for Django projects,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also django-enumfields · django-multiselectfield · django-sqids · django-flags · jsonfield · djfernet · django-enum · django-fernet-fields-v2 · django-pydantic-field · django-better-admin-arrayfield