Skip to main content

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

Project description

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

Supported Django versions: 1.6.x, 1.7.x, 1.8.x, 1.9.

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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-concurrency-1.1.tar.gz
Algorithm Hash digest
SHA256 9623a0470acef02f0eb4e07ecbad89c2aed41b956091d51e05b3f7bafa69ac7a
MD5 d3de4ac0dae0dceec5d8b517d3509346
BLAKE2b-256 b23b5f64b72b9bbbb0dc7a507806cd8b0fc7874ec8d82d5a3d253d112ec608ea

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