Skip to main content

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

Project description

Django Concurrency

Pypi coverage Test Docs

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

Uploaded Source

Built Distribution

django_concurrency-2.6.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_concurrency-2.6.0.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for django_concurrency-2.6.0.tar.gz
Algorithm Hash digest
SHA256 f5c4133d6497da91a8c2640f443e216160a38398b6c8506fe551770691fe2a1d
MD5 e0e10c409053116ab37e49913baad21c
BLAKE2b-256 b1a6c3d75900363ec8b723eb0b062a3c5f38db736a71d57d7198e6da8c28b8f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_concurrency-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eed723272c5450f102c0e7d03fbb1ab1253bcf853073d7ba356591eab88ecc9b
MD5 e992b9ca4dd30d49769072e440595201
BLAKE2b-256 c284ac13c62f90ceb83da90d89f46da9eef490aac7db4f47b9de8be3c6d6331d

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