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.tar.gz (21.0 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-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_concurrency-2.8.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for django_concurrency-2.8.tar.gz
Algorithm Hash digest
SHA256 17f2b3f0cefa0bb6a84ad9d4667f88761c4a8db751e03f27fedeacc0bc30b4a6
MD5 76aa86403f339a1e10e13f1d90ee3387
BLAKE2b-256 f49fcee126888ee469a7b0081164d63b3e31609ae508b2f8cc9038b40edb36da

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_concurrency-2.8.tar.gz:

Publisher: release.yml on saxix/django-concurrency

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for django_concurrency-2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e8ab89353185881305d2da6c80ec4a0603710e772f474c75352222c207edc5
MD5 4d55c4f0963c0795b3d5398f077acd50
BLAKE2b-256 e166aa6dcaff98557f28c4ae91a07e43a7c3274b15e3df43270e3d42c566bcd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_concurrency-2.8-py3-none-any.whl:

Publisher: release.yml on saxix/django-concurrency

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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