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

Uploaded Source

Built Distribution

django_concurrency-2.7-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_concurrency-2.7.tar.gz
  • Upload date:
  • Size: 20.7 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.7.tar.gz
Algorithm Hash digest
SHA256 90b7091039920e759a6b6feb1d481d918f3d6105bd1e2bff09ab781c2734cff3
MD5 bfddfbdafd7f7da8cd9a149e6bb630e1
BLAKE2b-256 7db734f3f007ba189497bebb48eb543572f00cfdd40b86061baf8ca649a978d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_concurrency-2.7.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.7-py3-none-any.whl.

File metadata

File hashes

Hashes for django_concurrency-2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3dfc1e7d1db436d578faf782c0027fac8296d34c175230ebcf91086c380ade88
MD5 d44abebab1422539b28d952133c6b061
BLAKE2b-256 4de97a332cef95a91598674994a6fda02ef88eee7d903af364444f15ddeab660

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_concurrency-2.7-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 Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page