Hello How do I detect when related models have changed; If I have models such as the following:
.. models.py class Model1(models.Model): field = models.CharField(max_length=255, default="Some value") class Model2(models.Model): field = models.CharField(max_length=255, default="Some value") class Model3(models.Model): field = models.CharField(max_length=255, default="Some value") class Model4(models.Model): one = models.OneToOneField(Model1) foreign = models.ForeignKey(Model2) many = models.ManyToManyField(Model3) counter = models.IntegerField(default=1) .. test.py one = Model1.objects.create() foreign = Model2.objects.create() many = [Model3.objects.create() for i in xrange(0,5)] x = Model2.objects.create(one=one, foreign=foreign) x.many = many x.save() Then I perform the following operations: one.field = "new value" one.save() foreign.field = "newer value" foreign.save() many[0].field = "newest value" many[0].save() How do I detect when these objects have changed? Is there a signal for this type of thing? For example if I want to increment Model4's counter field every time one of these objects change, what should I do? Thanks for any guidance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c1258a3e-9fad-4858-a1b3-bd44295fc6df%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.