On 12/09/2014 02:16 PM, Rune Kaagaard wrote:
> 
>>
>> A whole other issue is how to handle the deletion of already deleted 
>> objects.
>>
> I misspoke here. I meant how to handle the deletion of an object with an 
> outdated version number. Should it raise the same exception? 

Yes, I think that deletion is like any other update to an outdated model
- it should raise a concurrent modification exception.

FWIW, I also wrote an implementation of this a few years ago; I don't
know if there's much in it that would be useful to an implementation
built in to Django:
https://github.com/mozilla/moztrap/blob/master/moztrap/model/mtmodel.py

It's mixed in with a number of other things there (soft-deletion with
cascade, tracking of modifying user) but it's pretty easy to pick out
the concurrency-control bits by just searching for "cc_version".

I took the approach of adding an incrementing field to the model itself.
I think this is by far the best combination of simplicity and
performance, but it would definitely need to be an optional base class
if added to Django.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/548768A1.6000902%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to