Thomas, Do you use a custom manager to select out the row before issuing the save to make sure that the in memory timestamp matches that of the database?
Al. On Jan 24, 11:16 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Am Donnerstag, 24. Januar 2008 13:08 schrieb Tim Sawyer: > > > Hi Folks, > > > I'm just evaluating django for use on a project. I have a multiuser > > application where many users can be changing data at once. > > > What's the status of hibernate style optimistic locking, where each object > > has a version and update/deletes are prevented if the last saved version of > > that object is newer than the one being saved? > > Hi, > > I use this solution: > > The model class has an field mtime which get's updated automatically: > > class MyObject(models.Model): > mtime=models.DateTimeField(verbose_name=u'Letzte Ă„nderung am', > editable=False, auto_now=True) > > def mtime_has_changed(self, request): > mtime=request.POST['mtime'] > mtime=datetime.datetime(*[int(i) for i in re.findall(r'[\d]+', > mtime)]) > return self.mtime!=mtime > > Comments welcome > > HTH, > Thomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---