I have a post_save
handler that inserts additional records into the database referring to the instance that was just created or updated. However, an error (perhaps a constraint violation) may occur when inserting the additional records.
If an exception occurs in the post_save
handler, is it still possible that the initial instance will be committed?
The answer might depend on these sub-questions:
- Does Django's auto-commit mode commit before or after the
post_save
signal? - Does Django attempt to use nested transactions to rollback the instance being saved if an error occurs in
post_save
?