django-concurrency is an optimistic locking library for Django Models
It prevents users from doing concurrent editing in Django both from UI and from a django command.
- easy to add to existing Models (just add VersionField )
- can be added with Django internal models (ie auth.User or auth.Group)
- handle http post and standard python code (ie. django management commands)
- complete test suite (Test suite)
- Admin integration. Handle actions and list_editable (solves issue #11313)
- can handle external updates (see TriggerVersionField)
How it works¶
django-concurrency works adding a
concurrency.fields.VersionField to each model,
each time a record is saved the version number changes (the algorithm used depends
on the implementation of
concurrency.fields.VersionField used (see Fields).
Each update is converted in the following SQL clause like:
UPDATE mymodel SET version=NEW_VERSION, ... WHERE id = PK AND version = VERSION_NUMBER