Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saxix/django-concurrency
Optimistic lock implementation for Django. Prevents users from doing concurrent editing.
https://github.com/saxix/django-concurrency
concurrency django optimistic-locking
Last synced: 3 months ago
JSON representation
Optimistic lock implementation for Django. Prevents users from doing concurrent editing.
- Host: GitHub
- URL: https://github.com/saxix/django-concurrency
- Owner: saxix
- License: mit
- Created: 2012-03-20T01:05:04.000Z (over 12 years ago)
- Default Branch: develop
- Last Pushed: 2024-07-30T08:57:30.000Z (3 months ago)
- Last Synced: 2024-07-30T11:04:23.114Z (3 months ago)
- Topics: concurrency, django, optimistic-locking
- Language: Python
- Homepage:
- Size: 953 KB
- Stars: 430
- Watchers: 10
- Forks: 49
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
- starred-awesome - django-concurrency - Optimistic lock implementation for Django. Prevents users from doing concurrent editing. (Python)
README
Django Concurrency
==================[![Pypi](https://badge.fury.io/py/django-concurrency.svg)](https://badge.fury.io/py/django-concurrency)
[![coverage](https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=develop)](https://codecov.io/github/saxix/django-concurrency?branch=develop)
[![Test](https://github.com/saxix/django-concurrency/actions/workflows/tests.yaml/badge.svg)](https://github.com/saxix/django-concurrency/actions/workflows/tests.yaml)
[![Docs](https://readthedocs.org/projects/django-concurrency/badge/?version=stable)](http://django-concurrency.readthedocs.io/en/stable/)django-concurrency is an [optimistic lock][1] implementation for Django.
It prevents users from doing concurrent editing in Django both from UI and from a
django command.How it works
------------```python
from django.db import models
from concurrency.fields import IntegerVersionFieldclass ConcurrentModel( models.Model ):
version = IntegerVersionField( )
name = models.CharField(max_length=100)
```Now if you try::
```python
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][10]
and [django-locking][11] 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][2] 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][6])
* can be disabled if needed (see [disable_concurrency][3])
* [ConditionalVersionField][4] to handle complex business rulesProject Links
------------- Code: https://github.com/saxix/django-concurrency
- Documentation: https://django-concurrency.readthedocs.org/en/latest/
- Issue Tracker: https://github.com/saxix/django-concurrency/issues
- Download Package: http://pypi.python.org/pypi/django-concurrency/[10]:https://github.com/gavinwahl/django-optimistic-lock
[11]:https://github.com/stdbrouw/django-locking
[1]:http://en.wikipedia.org/wiki/Optimistic_concurrency_control
[2]:https://django-concurrency.readthedocs.org/en/latest/admin.html#list-editable
[3]:https://django-concurrency.readthedocs.org/en/latest/api.html?#disable-concurrency
[4]:https://django-concurrency.readthedocs.org/en/latest/fields.html#conditionalversionfield
[6]:https://django-concurrency.readthedocs.org/en/latest/fields.html#triggerversionfield