16👍
✅
Did you have a look at Django’s transaction docs? Especially the @transaction.commit_on_success (source code) decorator. It commits the transaction if the decorated function returns without raising an exception. If an exception occurs, it does a rollback.
Source:stackexchange.com