Optimistic lock implementation for Django. Prevents users from doing concurrent editing.
Python HTML Makefile
Clone or download
Latest commit b026d13 Jun 21, 2018
Permalink
Failed to load latest commit information.
.tx add Makefile Jun 30, 2013
docs minor docs fixes Dec 8, 2017
src minor docs fixes Dec 8, 2017
tests fixes travis matrix Dec 8, 2017
.editorconfig updates documentation Nov 3, 2015
.gitignore fixes django 1.11 compat issue May 2, 2017
.travis.yml fixes travis matrix Dec 8, 2017
AUTHORS init Apr 23, 2012
CHANGES minor docs fixes Dec 8, 2017
LICENSE change LICENSE Jul 15, 2016
MANIFEST.in open 1.3 alpha May 5, 2016
Makefile Django 2.0 support Dec 8, 2017
README.rst Fixes README.rst Jun 19, 2018
manage.py move to codecov Dec 13, 2015
setup.cfg Django 2.0 support Dec 8, 2017
setup.py minor docs fixes Dec 8, 2017
tox.ini updates tox Dec 8, 2017

README.rst

Django Concurrency

django-concurrency is an optimistic lock [1] implementation for Django.

Supported Django versions: 1.8.x, 1.9.x, 1.10.x., 1.11.x

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 master-build master-cov  
Development dev-build dev-cov  
Project home page: https://github.com/saxix/django-concurrency
Issue tracker: https://github.com/saxix/django-concurrency/issues?sort
Download: http://pypi.python.org/pypi/django-concurrency/
Documentation: https://django-concurrency.readthedocs.org/en/latest/
[1]http://en.wikipedia.org/wiki/Optimistic_concurrency_control
Join the chat at https://gitter.im/saxix/django-concurrency