Skip to main content

django-openutils

Practical Django model utilities. Currently ships ModelDiffMixin for tracking field changes.

Installation

pip install django-openutils

ModelDiffMixin

A model mixin that tracks field changes via __dict__ snapshotting. Uses concrete field attnames (e.g. author_id not author) so FK fields are compared by PK value without extra DB queries. Deferred fields are excluded from tracking.

Usage

from django.db import models
from django_openutils.mixins import ModelDiffMixin


class MyModel(ModelDiffMixin, models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField()
obj = MyModel.objects.create(name="Alice", email="alice@example.com")
obj.has_unsaved_changes  # False

obj.name = "Bob"
obj.has_unsaved_changes  # True
obj.unsaved_fields       # dict_keys(['name'])
obj.get_unsaved_field_diff("name")  # ('Alice', 'Bob')

obj.save()
obj.has_unsaved_changes  # False
obj.has_updated_fields   # True
obj.recent_updates       # {'name': ('Alice', 'Bob')}

API

Property / Method Description
unsaved_changes Dict of {field: (old, new)} for in-memory changes not yet saved
has_unsaved_changes True if any fields differ from the last save/load
unsaved_fields Keys of unsaved_changes
get_unsaved_field_diff(field) Returns (old, new) tuple or None
recent_updates Dict of {field: (old, new)} from the last save() call
has_updated_fields True if recent_updates is non-empty
updated_fields Keys of recent_updates

License

MIT - see LICENSE for details.

Metadata

Release files for django-openutils 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-openutils 0.1.0
File Size Uploaded Provenance Actions
django_openutils-0.1.0.tar.gz 5.3 kB With provenance Details for django_openutils-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-openutils 0.1.0
File Interpreter ABI Platform Actions
django_openutils-0.1.0-py3-none-any.whl Python 3 none any Details for django_openutils-0.1.0-py3-none-any.whl

Total release size: 9.7 kB

Release files / django_openutils-0.1.0.tar.gz

Download URL django_openutils-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
51d6a04bb5f1506952cc67d45699bc0eb4e1d9e2de1f3c5faa39b0daf68f263e
BLAKE2b-256 checksum
How to use checksums
bdcd52b81297306ce477001c5f9db034a40797808d272acef194f0782a8d0089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Release files / django_openutils-0.1.0-py3-none-any.whl

Download URL django_openutils-0.1.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b32cee59d8f915f0e04e3db5a150af22d333570c763b33055074ef500203a37f
BLAKE2b-256 checksum
How to use checksums
c70e9c8cfa6401979a85c23279f17f5bb4fababbf8cc695f583ea99a3dc8a289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Security for django-openutils 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_openutils-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page