django-deprecate-fields
This package allows deprecating model fields and allows removing them in a backwards compatible manner.
What it is and what it does
Django-deprecate-fields provides a decorator-based approach to safely remove model fields from a Django application without breaking existing code during the transition period. When you wrap a field with `deprecate_field()`, the package automatically converts it to nullable during the next migration, and any code accessing the field will receive None instead of raising an error. This allows you to deploy the deprecation marker, run migrations, then safely remove the field definition in a subsequent deployment—a three-step process that maintains backward compatibility across your application.
The package is designed for teams managing long-lived Django projects where fields need to be retired gradually. It handles the common Django commands (makemigrations, migrate, showmigrations) automatically, and supports custom migration commands via a settings parameter. With a single runtime dependency on Django and no known vulnerabilities, it integrates cleanly into existing projects.
Use it for:
- Mark a database column as deprecated in one release, allowing code to stop using it before physical removal in a later release.
- Provide a default return value (via `return_instead` argument) when deprecated fields are accessed, easing the transition for legacy code.
- Coordinate field removal across multiple services by using the three-step deprecation workflow without requiring simultaneous deployments.
- Audit which parts of your codebase still reference deprecated fields by catching None returns or custom fallback values.
- Support custom migration tools (e.g., pgmakemigrations) by configuring DEPRECATE_FIELD_CUSTOM_MIGRATION_COMMAND in settings.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a decorator to mark Django model fields as deprecated, automatically making them nullable and returning None on access, enabling safe field removal across deployments.
Yes. This package solves a real operational problem—removing Django model fields safely across multiple deployments—with low install friction, active maintenance, and no security issues. It is most valuable for teams managing production Django applications where coordinated deployments are difficult or where you need to support older code during a transition period. If you rarely remove fields or always deploy atomically, the benefit is lower.
Install
django-deprecate-fields on PyPI
pip
pip install django-deprecate-fieldsuv
uv add django-deprecate-fieldspoetry
poetry add django-deprecate-fieldsInstalling django-deprecate-fields
Before you install
Low friction install with a single runtime dependency on Django. Actively maintained with a recent commit and no known vulnerabilities.
License in practice
Released under Apache License 2.0, a permissive license allowing commercial use with minimal restrictions.
Quickstart
pip install django-deprecate-fields
from django_deprecate_fields import deprecate_field
from django.db import models
class MyModel(models.Model):
field1 = deprecate_field(models.CharField())
field2 = models.CharField()
Verify before relying
- Whether the package works with Django versions released after 3.1, given classifiers only list up to 3.1
- Whether Python 2.7 support is actively maintained or a legacy artifact
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Django |
| Maintenance | actively maintained — 206 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,839,332/month — #2,866 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_deprecate_fields-0.2.3-py3-none-any.whl
Keywords: django, migration, deprecation, database, backward, compatibility
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
django-add-default-valueProvides a Django migration operation to set…
permissive · top 15,000 on PyPI
jsonfieldA Django model field that stores and retrieves…
permissive · top 5,000 on PyPI
django-cleanupAutomatically deletes old files when Django…
permissive · top 15,000 on PyPI
django-migration-linterAnalyzes Django migrations to detect…
permissive · top 5,000 on PyPI
legacy-api-wrapProvides a decorator to wrap legacy function…
copyleft · top 5,000 on PyPI
fieldsGenerates lightweight container classes with…
permissive · top 15,000 on PyPI
django-citextProvides PostgreSQL CIText field types for…
permissive · top 15,000 on PyPI
django-choices-fieldProvides Django model fields that store and…
permissive · top 15,000 on PyPI
deprecationProvides decorators to automate deprecation…
permissive · top 1,000 on PyPI
django-soft-deleteAdds soft deletion to Django models by marking…
permissive · top 15,000 on PyPI