django-fields-history
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"
obj.save()
assert obj.get_field_history()
assert obj.get_field_history()[0].value == "value"
QuickStart
Install django-fields-history:
pip install django-fields-history
Add fields_history.postgres to INSTALLED_APPS (currently only
postgres implementation is supported):
INSTALLED_APPS = [
# rest of apps
"fields_history.postgres",
]
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.
Implementation
Every change of your fields field changes be tracked in
fields_history.models.FieldsHistory in:
fields_history.postgres-JSONBpostgres field
One object per save if tracked fields has been changed.
Credits
Basically this project is implemented based on django-field-history which itself used django-model-utils.
Metadata
Release files for django-fields-history 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_fields_history-0.1.7.tar.gz | 6.1 kB | Without provenance | Details for django_fields_history-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_fields_history-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for django_fields_history-0.1.7-py3-none-any.whl |
Total release size: 14.0 kB
Release files / django_fields_history-0.1.7.tar.gz
| Download URL | django_fields_history-0.1.7.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7128a070366a0783257e813ea637a6e75bf793ad026127e34ac40f8608c70138
|
|
BLAKE2b-256 checksum How to use checksums |
fbef7dd490b18beaab7f88482013a6a10b8914f751b3611fd5b20442d86bee83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.5 Darwin/22.6.0
|
Release files / django_fields_history-0.1.7-py3-none-any.whl
| Download URL | django_fields_history-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31d25bbd1d33c1202e4ac438520e94dead8f3653af15c18b8015c56c049dce95
|
|
BLAKE2b-256 checksum How to use checksums |
fac43d0bf9e901c8966560859797fabb8f069d768e59053f8c9e01a55e58f91d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.5 Darwin/22.6.0
|
Security for django-fields-history 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.