A base model class for adding version information and preventing concurrent modifications
Project description
django-model-versions
A library for adding version information to models. This version information is then used to prevent concurrent modifications. E.g.
>>> b1 = Blog.objects.get(id=1) >>> b2 = Blog.objects.get(id=1) # Same row as b1 >>> b1.title = 'Some blog' >>> b1.save() >>> b2.title = 'Some other blog' >>> b2.save()
Will result in a ConcurrentModificationException being raised instead of overriding the data saved by b1.
Usage
Subclass modelversions.VersionedModel instead of django.db.models.Model. That’s it!
Known flaws
objects.update(…) will not increment the version number for objects altered. This would be better as a mixin. object.delete() will not check versioning Django admin hates it
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-model-versions-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd95c438e4e8f832fcab40f4a01496adf0659b51cd15c80fe47975ec94f05902 |
|
MD5 | b7aac0ae34ec4089c4fc2c84cb24e6e7 |
|
BLAKE2b-256 | 36f618fec9b1511a0e8ff7bc685e6dfed3abacaff7f29364a2583a1ba33b22fb |
Close
Hashes for django-model-versions-0.4.0.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69764e828f0638d5e5482bdfa3089f1406b16ec01dd3add797083e8e703c7d84 |
|
MD5 | 9cd87a0d90e776e2e304149fad361622 |
|
BLAKE2b-256 | e5e32a1c328ee16dbf5c15573f37a8378959e7fa8b88b0c3ae1505b0cf85dbbc |