django-planet
Aug. 21, 2022

Use partial() With Django’s transaction.on_commit() to Avoid Late-Binding Bugs

published by Adam Johnson
in blog Adam Johnson
original entry 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.

Although Django’s documentation says that on_commit() takes a “function …