Django post_save preventing recursion without overriding model save()

前端 未结 9 1588
轻奢々
轻奢々 2020-11-29 23:41

There are many Stack Overflow posts about recursion using the post_save signal, to which the comments and answers are overwhelmingly: \"why not override save()\

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 00:40

    you can use update instead of save in the signal handler

    queryset.filter(pk=instance.pk).update(....)
    

提交回复
热议问题