Basically, I want to be able to do something if the value of a field changes in a model.
c = Category.objects.get(pk=1) c.name = "New Name" c.save() At any point (when the model is saved, when the value is set, etc.) is it possible to compare the old and new value? The first thought that popped into my head was something like this. I know this exact code isn't possible, it's just an example of what I'm trying to do. class Category(models.Models): def save(self): if self.name.old_value != self.name.value: do something fun here super(Category, self).save() If something like this isn't built in to Django, I was thinking of writing a custom field and overwriting __set__() to store the old value somewhere, since that seems to be the only place that would have access to the new and old value. Any thoughts on whether that's the best method? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---