Optimistic locking library for Django
django-concurrency is an optimistic locking library for Django.
Tested with: 1.4.8, 1.5.4, 1.6b4, trunk.
It prevents users from doing concurrent editing in Django both from UI and from a django command.
How it works
from concurrency.fields import IntegerVersionField class ConcurrentModel( models.Model ): version = IntegerVersionField( )
Now if you try:
a = ConcurrentModel.objects.get(pk=1) b = ConcurrentModel.objects.get(pk=1) a.save() b.save()
you will get a RecordModifiedError on b.save()