Maybe it's just late, but I cannot figure out why this isn't working. When I have a post_save signal call a generic function, it works, but when I have a post_save signal call a method from a model, nothing happens. Here is code that works:
class Revision(models.Model):
# Model junk...
def send_email(sender, instance, created, **kwargs):
if created:
print "DO STUFF"
signals.post_save.connect(send_email, sender=Revision)
But this does not work:
class Revision(models.Model):
# Model junk...
def send_email(sender, instance, created, **kwargs):
if created:
print "DO STUFF"
signals.post_save.connect(Revision.send_email, sender=Revision)
Is there a kind soul out there who will keep me from smashing my head into the wall? Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…