Here are two of my models in Django(1.5):
class ActNews(models.Model):
actNews_Activity_key = ForeignKey(Activity)
actNewsCheck = BooleanField(default=False)
… …
def save(self, *args, **kwargs):
if self.actNewsCheck == True:
self.actNews_Activity_key.act_newsPostCheck = True
self.actNews_Activity_key.save()
super(ActNews, self).save(*args, **kwargs)
class Activity(models.Model):
act_newsPostCheck = BooleanField(default=False)
… …
What I want to do is when ActNews.actNewsCheck
is True
, then set act_newsPostCheck
to True
automatically. I override the save()
method in ActNews.
Am I doing it correctly? I mean, reasonably? Should I use signal instead of this? BTW, I'm new to Django's signal, and I'm really confused about it, and I seem to fail to see a full example while searching around, it would be really great if you can provide one!
Any ideas? Thanks in advance!