On Tuesday 08 July 2014 01:13 PM, Anand Reddy Pandikunta wrote:
Hi,

*models.py*

*def my_func(sender, instance, created, **kwargs):*
*      # do something*
*      instance.status = 'task completed'*
*      instance.save()*

*class MyModel(models.Model):*
*      status = models.CharField(max_length=100, blank=True)*
*      # some code*

*signals.post_save.connect(my_func, sender=MyModel)*

Like others have noted, you should override model save. Another option would be to use pre_save. Just set instance.status and don't call instance.save?
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to