I'm working with Django and have a question regarding transaction behavior when using signals.
Let's say I have a Django model where the save() method is wrapped inside an @transaction.atomic block. I also have a post_save signal connected to this model, and that signal is also wrapped in @transaction.atomic.
If an exception is raised inside the post_save signal, will that error cause the changes made in the save() method to be rolled back as well?
In other words:
- Does the
post_savesignal share the same database transaction as thesave()method when usingtransaction.atomic? - If so, will any unhandled exception in the signal handler cause the entire transaction—including the model save—to be rolled back?