Optimistic lock implementation for Django. Prevents users from doing concurrent editing.
Project description
django-concurrency is an optimistic lock [1] implementation for Django.
It prevents users from doing concurrent editing in Django both from UI and from a django command.
How it works
sample code:
from django.db import models from concurrency.fields import IntegerVersionField class ConcurrentModel( models.Model ): version = IntegerVersionField( ) name = models.CharField(max_length=100)
Now if you try:
a = ConcurrentModel.objects.get(pk=1) a.name = '1' b = ConcurrentModel.objects.get(pk=1) b.name = '2' a.save() b.save()
you will get a RecordModifiedError on b.save()
Similar projects
Other projects that handle concurrent editing are django-optimistic-lock and django-locking anyway concurrency is “a batteries included” optimistic lock management system, here some features not available elsewhere:
can be applied to any model; not only your code (ie. django.contrib.auth.Group)
handle list-editable ChangeList. (handle #11313)
manage concurrency conflicts in admin’s actions
can intercept changes performend out of the django app (ie using pgAdmin, phpMyAdmin, Toads) (using TriggerVersionField)
can be disabled if needed (see disable_concurrency)
ConditionalVersionField to handle complex business rules
Links
Stable |
|||||
Development |
|||||
Project home page: |
|||||
Issue tracker: |
|||||
Download: |
|||||
Documentation: |
_list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#list-editable
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
Hashes for django_concurrency-2.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7dcec114ba14216c97c33870de45b62e381aa99ec3c7c4e047921b25d9246f |
|
MD5 | 9d46945996cd76a7f122c033924462e9 |
|
BLAKE2b-256 | 3ddaeb0dd5d63459f5ae7d66a2693e138cc101cc9436e435d40eedf53cf0a229 |