The post_save 'created' argument could help if you only wanted to trigger 
the signal when the Person was first created:

@receiver(post_save, sender=Person)
def do(instance, *args, **kwargs):
    if kwargs.get('created'):
        instance.ok = True
        instance.save()
    


On Friday, March 13, 2015 at 5:35:46 AM UTC, Neto wrote:
>
> What is the best way to avoid recursion when using post_save?
>
> @receiver(post_save, sender=Person)
> def do(sender, instance, *args, **kwargs):
>     instance.ok = True
>     instance.save()
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/09db8258-208d-4b05-8d1e-1a5cae9ce262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to