Skip to main content

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

Project description

Django Concurrency

Pypi coverage Test Docs Django Supported Python versions

django-concurrency is an optimistic lock implementation for Django.

It prevents users from doing concurrent editing in Django both from UI and from a django command.

How it works

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 <https://code.djangoproject.com/ticket/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 Links

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.8.1.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_concurrency-2.8.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file django_concurrency-2.8.1.tar.gz.

File metadata

  • Download URL: django_concurrency-2.8.1.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for django_concurrency-2.8.1.tar.gz
Algorithm Hash digest
SHA256 621817c0cf8b344d14389cdf7d9040080717292cde88ecbd471facb79614afbf
MD5 9a54fb0f01a207b246ed46714e461e54
BLAKE2b-256 915794ce0cb4592ff43f4e9671bc2e7fc4d50c1c7f71d56fe85a6637d7b58306

See more details on using hashes here.

File details

Details for the file django_concurrency-2.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_concurrency-2.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 785e0c47052d47438cb99dc9ff128b8166c24377284080bdd7f3a57dbeb4c56a
MD5 a44042f6c99c6d031399e55b5463bbca
BLAKE2b-256 c4c7657936235e0176a27bd56d556ad9ab427bfdab0fe29c2447bc39510bf6d5

See more details on using hashes here.

Supported by

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