Skip to main content

Store model fields history

Project description


A Django app that track history changes in model fields.

Important note: currently only one implementation of FieldsHistory is supported and it's with django.contrib.postgres.fields.JSONField which is JSONB under the hood. So only postgresql as database is supported

Similar projects:

Main difference that those libraries keep track of changes, and this library tracks the history change.

Simple explanation:

from field_history.trackers import FieldsHistoryTracker

class SimpleModel(models.Model):
    field = models.CharField(max_length=50)

    field_history = FieldsHistoryTracker(fields=['field'])

obj = SimpleModel.objects.create(field='value')
assert not obj.get_field_history()

obj.field = "new_value"
assert obj.get_field_history()
assert obj.get_field_history()[0].value == "value"


Install django-fields-history:

pip install django-fields-history

Add fields_history.postgres to INSTALLED_APPS (currently only postgres implementation is supported):

    # rest of apps

And add trackers to your models and specify fields to track:

from field_history.trackers import FieldsHistoryTracker

class YourModel(models.Model):

    history_tracker = FieldsHistoryTracker(fields=["field1", "field2"])

And you are done.


Every change of your fields field changes be tracked in fields_history.models.FieldsHistory in:

  • fields_history.postgres - JSONB postgres field

One object per save if tracked fields has been changed.


Basically this project is implemented based on django-field-history which itself used django-model-utils.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-fields-history-0.1.1.tar.gz (6.4 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page