Skip to main content

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

Project description

==================
Django Concurrency
==================


.. image:: https://badge.fury.io/py/django-concurrency.svg
:target: http://badge.fury.io/py/django-concurrency
:alt: PyPI package


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

Supported Django versions: 1.8.x, 1.9.x, 1.10.x., 1.11.x, 2.x

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 <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


Links
~~~~~

+--------------------+----------------+--------------+------------------------+
| Stable | |master-build| | |master-cov| | |
+--------------------+----------------+--------------+------------------------+
| Development | |dev-build| | |dev-cov| | |
+--------------------+----------------+--------------+------------------------+
| Project home page: |https://github.com/saxix/django-concurrency |
+--------------------+---------------+----------------------------------------+
| Issue tracker: |https://github.com/saxix/django-concurrency/issues?sort |
+--------------------+---------------+----------------------------------------+
| Download: |http://pypi.python.org/pypi/django-concurrency/ |
+--------------------+---------------+----------------------------------------+
| Documentation: |https://django-concurrency.readthedocs.org/en/latest/ |
+--------------------+---------------+--------------+-------------------------+

.. |master-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.svg?branch=master
:target: http://travis-ci.org/saxix/django-concurrency/

.. |master-cov| image:: https://codecov.io/gh/saxix/django-concurrency/branch/master/graph/badge.svg
:target: https://codecov.io/gh/saxix/django-concurrency

.. |master-doc| image:: https://readthedocs.org/projects/django-concurrency/badge/?version=stable
:target: http://django-concurrency.readthedocs.io/en/stable/

.. |dev-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.svg?branch=develop
:target: http://travis-ci.org/saxix/django-concurrency/

.. |dev-cov| image:: https://codecov.io/gh/saxix/django-concurrency/branch/develop/graph/badge.svg
:target: https://codecov.io/gh/saxix/django-concurrency

.. |dev-doc| image:: https://readthedocs.org/projects/django-concurrency/badge/?version=stable
:target: http://django-concurrency.readthedocs.io/en/stable/



.. |wheel| image:: https://img.shields.io/pypi/wheel/django-concurrency.svg

_list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#list-editable


.. _django-locking: https://github.com/stdbrouw/django-locking

.. _django-optimistic-lock: https://github.com/gavinwahl/django-optimistic-lock

.. _TriggerVersionField: https://django-concurrency.readthedocs.org/en/latest/fields.html#triggerversionfield

.. _ConditionalVersionField: https://django-concurrency.readthedocs.org/en/latest/fields.html#conditionalversionfield

.. _disable_concurrency: https://django-concurrency.readthedocs.org/en/latest/api.html?#disable-concurrency



.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/saxix/django-concurrency
:target: https://gitter.im/saxix/django-concurrency?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge


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

Uploaded Source

Built Distribution

django_concurrency-2.0-py2.py3-none-any.whl (27.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: django-concurrency-2.0.tar.gz
  • Upload date:
  • Size: 61.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for django-concurrency-2.0.tar.gz
Algorithm Hash digest
SHA256 1e749a28d20816092980f4048c2c841cc68a5df9125f1c6c752149c8e2437545
MD5 39f59e19bf418aea86780976300a9d33
BLAKE2b-256 8ff2685ef1be992c01436a16cd617781a2f2420a98d6725c784ac208fa5d16a6

See more details on using hashes here.

File details

Details for the file django_concurrency-2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_concurrency-2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for django_concurrency-2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 06871dc2d1e80fad6c0c2428845aa3c6a648bfbbd10f01e10245876e782149f9
MD5 4974a77dfa3ab17e527e7dc5f1e3f386
BLAKE2b-256 86dc8357326d158403c4e8d4d8bc192f1861e7a9a135905e374944b5b32eb10e

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