
Use partial() With Django’s transaction.on_commit() to Avoid Late-Binding Bugs
Django’s
transaction.on_commit()
allows you to run a function after the current database transaction is committed. This is useful to ensure that actions with external services, like sending emails, don’t run until the relevant data is definitely saved. Adam Johnson covers four techniques for passing callables to on_commit()
.