Registry / database / django-field-history

django-field-history

JSON →
library0.8.0pypypiunverified

A Django app to track changes to specific model fields. Version 0.8.0 is the latest. Releases are sporadic; no major changes since v0.6.0.

pip install django-field-history
INSTALL
IMPORT
SIG · DJANGO-FIELD-HISTO
D
django-field-history
databasepythonv0.8.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FieldHistoryMiddleware
from field_history.middleware import FieldHistoryMiddleware
from django_field_history.middleware import FieldHistoryMiddleware

Enable field tracking by adding the app and middleware, then attach HistoricalRecords to your model with the fields you want to track.

# settings.py INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.admin', 'django_field_history', # ... ] MIDDLEWARE = [ 'django_field_history.middleware.FieldHistoryMiddleware', # ... ] # models.py from django.db import models from django_field_history.models import HistoricalRecords class MyModel(models.Model): name = models.CharField(max_length=100) history = HistoricalRecords(fields=['name']) # Run migrations and use admin to see history.
Debug
Known issues
gotchaMust also add 'django.contrib.contenttypes' to INSTALLED_APPS if not already present, otherwise migrations fail.
fix
Ensure 'django.contrib.contenttypes' is in INSTALLED_APPS.
affects: all
gotchaThe FieldHistoryMiddleware uses the session to store the current user. If your site uses an authentication backend that does not set request.user correctly, history will be attributed to AnonymousUser.
fix
Ensure authentication is set up so request.user is available; place FieldHistoryMiddleware after SessionMiddleware and AuthenticationMiddleware.
affects: all
Upgrade
Version history
0.8.0latest on PyPI · released Jan 5, 2020
Audit
Dependencies
DjangorequiredCore framework dependency
Agent activity
4 hits · last 30 days
node
4
Resources
django-field-history — pip install django-field-history · libregistry