Re: [BangPypers] Django - Infinte Loop

2014-07-11 Thread Arun Ravindran
Hi, >From Django 1.7 onwards, the proper way to register signals will be inside a ready function in the app's configuration object. This is thanks to the App-loading refactor done in the release. In your case, a

Re: [BangPypers] Django - Infinte Loop

2014-07-11 Thread Anand Reddy Pandikunta
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 wro

Re: [BangPypers] Django - Infinte Loop

2014-07-09 Thread Pradip Caulagi
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_leng

Re: [BangPypers] Django - Infinte Loop

2014-07-08 Thread Navin Kabra
1. Why are you doing this using a signal? Signals are best used when saving of Model1 needs to trigger some action on Model2. If you want to modify Model1 itself, you're better off doing this inside MyModel::save 2. If you really want to do it this way, put an if condition in my_func so that insta

Re: [BangPypers] Django - Infinte Loop

2014-07-08 Thread kracekumar ramaraju
Hi Anand I would save *don't* use Django signal. Signals are hard to test and don't know when they will be executed. Suggestions - If post_save function does some work like updating external service which can take data, use rq or celery. - You can override django save. class MyModel(BaseClass):

[BangPypers] Django - Infinte Loop

2014-07-08 Thread Anand Reddy Pandikunta
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.conne