[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

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

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

[BangPypers] Test python interpreter

2014-07-08 Thread Nitin Kumar
Hi All, We will have instrumented python in our proprietary OS. Is their a way/tool to test the basic functionality of Python. Nitin K ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] BangPypers Digest, Vol 83, Issue 3

2014-07-08 Thread Pratik Mandrekar
Notes on using the post_save signal 1 - Do not use post_save to save the instance that is passed. The `instance.save` is going to cause a never ending loop. 2 - Use post_save signal to do things not related to updating the model being saved. Like updating a related model. 3 - Override the save me