I have overrided model save.
Moved couple of functions from models.py to tasks.py which lead to circular
imports.
Instead of importing models at the beginning of file, I've imported them in
the functions.

Thank you @krace, @navin, @pradip :)



On Thu, Jul 10, 2014 at 11:12 AM, Pradip Caulagi <ppc.li...@gmail.com>
wrote:

> 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
>



-- 
- Anand Reddy Pandikunta
www.avilpage.com
www.quotes160.com
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to