I am using Django for a web application and I want to implement some code to detect changes in my model (and use that to update the model). I have fiddled with save:
class MyModel(models.Model): def save(self, *args, **kw): if self.somevalue == 0: self.someothervalue = timezone.now() else: self.someothervalue = None super(MyModel, self).save(*args, **kw) but this will also update someothervalue to timezone.now() when somevalue already was 0. I want it only to update if it becomes 0.
How do I do that?