{"id":23574,"library":"django-field-history","title":"django-field-history","description":"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.","status":"active","version":"0.8.0","language":"python","source_language":"en","source_url":"https://github.com/grantmcconnaughey/django-field-history","tags":["django","field-history","audit","tracking"],"install":[{"cmd":"pip install django-field-history","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Core framework dependency","package":"Django","optional":false}],"imports":[{"note":"Old import path without django_ prefix; still works in some setups but not recommended.","wrong":"from field_history.middleware import FieldHistoryMiddleware","symbol":"FieldHistoryMiddleware","correct":"from django_field_history.middleware import FieldHistoryMiddleware"},{"note":"Use the django_ prefixed module.","wrong":"from field_history.models import HistoricalRecords","symbol":"HistoricalRecords","correct":"from django_field_history.models import HistoricalRecords"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    'django.contrib.contenttypes',\n    'django.contrib.admin',\n    'django_field_history',\n    # ...\n]\nMIDDLEWARE = [\n    'django_field_history.middleware.FieldHistoryMiddleware',\n    # ...\n]\n\n# models.py\nfrom django.db import models\nfrom django_field_history.models import HistoricalRecords\n\nclass MyModel(models.Model):\n    name = models.CharField(max_length=100)\n    history = HistoricalRecords(fields=['name'])\n\n# Run migrations and use admin to see history.","lang":"python","description":"Enable field tracking by adding the app and middleware, then attach HistoricalRecords to your model with the fields you want to track."},"warnings":[{"fix":"Ensure 'django.contrib.contenttypes' is in INSTALLED_APPS.","message":"Must also add 'django.contrib.contenttypes' to INSTALLED_APPS if not already present, otherwise migrations fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure authentication is set up so request.user is available; place FieldHistoryMiddleware after SessionMiddleware and AuthenticationMiddleware.","message":"The 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'django_field_history.middleware.FieldHistoryMiddleware' in MIDDLEWARE.","cause":"The import path changed from field_history to django_field_history in v0.6.0. The old path may still be in middleware.","error":"django.core.exceptions.ImproperlyConfigured: 'django_field_history.middleware.FieldHistoryMiddleware' is not a middleware class"},{"fix":"Add 'django.contrib.contenttypes' to INSTALLED_APPS and run migrations again.","cause":"Forgetting to include django.contrib.contenttypes in INSTALLED_APPS before running migrations.","error":"django.db.migrations.exceptions.InconsistentMigrationHistory: Migration django_field_history.0001_initial is applied before its dependency django_content_type.0001_initial"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}