Blog: Adam Johnson

web https://adamj.eu/
Author

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

Aug. 21, 2022 » Adam Johnson » [Archived Version]

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 …

Read More

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

Aug. 21, 2022 » Adam Johnson » [Archived Version]

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 …

Read More

How to Run a Django Migration “By Hand”

June 28, 2022 » Adam Johnson » [Archived Version]

Normally your Django project’s deploy process runs the migrate command, and that takes care of updating your database as necessary. Especially on smaller databases, Django’s migration system can “just do it” for you. But sometimes it can be necessary to run migrations “by hand” in your database’s …

Read More

How to Run a Django Migration “By Hand”

June 28, 2022 » Adam Johnson » [Archived Version]

Normally your Django project’s deploy process runs the migrate command, and that takes care of updating your database as necessary. Especially on smaller databases, Django’s migration system can “just do it” for you. But sometimes it can be necessary to run migrations “by hand” in your database’s …

Read More