Skip to content

Optimistic lock implementation for Django. Prevents users from doing concurrent editing.

License

Notifications You must be signed in to change notification settings

boatcoder/django-concurrency

This branch is 99 commits behind saxix/django-concurrency:develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f84cc56 · Oct 22, 2020
Sep 9, 2018
Oct 22, 2020
Oct 22, 2020
Oct 22, 2020
Nov 3, 2015
Jun 7, 2020
Sep 9, 2018
Jun 7, 2020
Sep 9, 2018
Oct 22, 2020
Jul 15, 2016
Sep 9, 2018
Oct 29, 2018
Mar 29, 2019
Jun 7, 2020
Sep 9, 2018
Sep 9, 2018
Oct 22, 2020
Oct 22, 2020

Repository files navigation

Django Concurrency

PyPI package

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

Supported Django versions:

  • <=2.1.1 supports 1.11.x, 2.1.x, 2.2.x, 3.x
  • >=2.2 supports 3.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/

_list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#list-editable

Join the chat at https://gitter.im/saxix/django-concurrency
[1]http://en.wikipedia.org/wiki/Optimistic_concurrency_control

About

Optimistic lock implementation for Django. Prevents users from doing concurrent editing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.4%
  • HTML 1.7%
  • Makefile 0.9%