Skip to main content

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

Project description

PyPI package

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-concurrency-2.4.tar.gz (132.4 kB view details)

Uploaded Source

Built Distribution

django_concurrency-2.4-py2.py3-none-any.whl (61.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-concurrency-2.4.tar.gz.

File metadata

  • Download URL: django-concurrency-2.4.tar.gz
  • Upload date:
  • Size: 132.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0

File hashes

Hashes for django-concurrency-2.4.tar.gz
Algorithm Hash digest
SHA256 6d45e19f4a288da34578aaeb8eceb394ffac5bfaee8dc43f157c051c7b9cae6c
MD5 3f9e18d14fc179c7d9541d43fe9b4936
BLAKE2b-256 f0385ab273b21f0dabc9cc41ac82b262c70fc2189e4a25b522d36ab43ff8652e

See more details on using hashes here.

File details

Details for the file django_concurrency-2.4-py2.py3-none-any.whl.

File metadata

  • Download URL: django_concurrency-2.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 61.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0

File hashes

Hashes for django_concurrency-2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ae7dcec114ba14216c97c33870de45b62e381aa99ec3c7c4e047921b25d9246f
MD5 9d46945996cd76a7f122c033924462e9
BLAKE2b-256 3ddaeb0dd5d63459f5ae7d66a2693e138cc101cc9436e435d40eedf53cf0a229

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page