django-deprecated-field
raw JSON → 0.1.1 verified Fri May 01 auth: no python
Utility for marking Django DB fields as deprecated, enabling migration consistency with rolling deploys. Current version 0.1.1, supports Django 6, requires Python >=3.12. Low release cadence.
pip install django-deprecated-field Common errors
error ImportError: cannot import name 'DeprecatedField' ↓
cause Incorrect import path (e.g., from deprecated_field import DeprecatedField).
fix
Use 'from django_deprecated_field import DeprecatedField'
error TypeError: 'DeprecatedField' object is not iterable ↓
cause Using DeprecatedField in a QuerySet filter or iteration expecting a standard field.
fix
Ensure you query the underlying field directly (e.g., MyModel.objects.filter(old_field__exact='value'))
Warnings
gotcha Using DeprecatedField without the `replacement` argument will not raise warnings on write, only reads of the deprecated field trigger the deprecation warning.
breaking Requires Python >=3.12; older Python versions are not supported.
gotcha DeprecatedField does NOT prevent writes to the deprecated field; it only warns on read. Write migration must be handled separately.
Imports
- DeprecatedField
from django_deprecated_field import DeprecatedField
Quickstart
from django.db import models
from django_deprecated_field import DeprecatedField
class MyModel(models.Model):
old_field = DeprecatedField(models.CharField(max_length=100), replacement='new_field')
new_field = models.CharField(max_length=100)