djangosignals

django signals with bulk delete/update


I can't find any documentation on why does this happen, but according to the docs bulk operations should not trigger models signals.

Now the issue is this, if i do somequeryset.delete()a signal is triggered for each deleted object even if it is a bulk operation! On the other hand, somequeryset.update(someField=5) will NOT trigger any signal!

So this is pretty much an unexpected result, I would hope for both to behave the same.

Django 1.7.7

Any ideas? I want deletes to have a signal but triggering it on bulk deletes is not acceptable


Solution

  • As explained here it really doesn't call delete() method on each item but it DOES calls signals. I don't know if that is possible but I also agree that there should be at least some option en queryset.delete() to skip signals execution.