Tracking dirty fields on a Django model instance. Dirty means that field in-memory and database values are different.
This package is compatible and tested with the following Python & Django versions:
Python |
Django |
|---|---|
3.10 |
3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2 |
3.11 |
4.1, 4.2, 5.0, 5.1, 5.2 |
3.12 |
4.2, 5.0, 5.1, 5.2, 6.0 |
3.13 |
5.1, 5.2, 6.0 |
3.14 |
5.2, 6.0 |
Install
$ pip install django-dirtyfields
Usage
To use django-dirtyfields, you need to:
Inherit from DirtyFieldsMixin in the Django model you want to track.
from django.db import models
from dirtyfields import DirtyFieldsMixin
class ExampleModel(DirtyFieldsMixin, models.Model):
"""A simple example model to test dirty fields mixin with"""
boolean = models.BooleanField(default=True)
characters = models.CharField(blank=True, max_length=80)
Use one of these 2 functions on a model instance to know if this instance is dirty, and get the dirty fields:
is_dirty()
get_dirty_fields()
Example
>>> model = ExampleModel.objects.create(boolean=True,characters="first value")
>>> model.is_dirty()
False
>>> model.get_dirty_fields()
{}
>>> model.boolean = False
>>> model.characters = "second value"
>>> model.is_dirty()
True
>>> model.get_dirty_fields()
{'boolean': True, "characters": "first_value"}
Consult the full documentation for more information.
Metadata
Release files for django-dirtyfields 1.9.9
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_dirtyfields-1.9.9.tar.gz | 22.2 kB | Without provenance | Details for django_dirtyfields-1.9.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_dirtyfields-1.9.9-py3-none-any.whl | Python 3 | none | any | Details for django_dirtyfields-1.9.9-py3-none-any.whl |
Total release size: 29.9 kB
Release files / django_dirtyfields-1.9.9.tar.gz
| Download URL | django_dirtyfields-1.9.9.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c11c8e03827166d2c91f6634a4d10f5aa5cc7ea430d60e5bd576b3ebf319172f
|
|
BLAKE2b-256 checksum How to use checksums |
8e0d0c7d727f7f14f82450b72e5213c6ed0da3d16add2de2e59d46aea6b6eaa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / django_dirtyfields-1.9.9-py3-none-any.whl
| Download URL | django_dirtyfields-1.9.9-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80da479ab989331e6f29c90576e5f7d7b3df65b36f16bfd6f5d37a0dbdeda6b0
|
|
BLAKE2b-256 checksum How to use checksums |
1882d274e924565c2b11eb59fadb5c95885b10502755b4f458bea477a9a6f8af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for django-dirtyfields 1.9.9
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.