Thursday, 13th October 2022
How to implement a “dry run mode” for data imports in Django
(via)
Adam Johnson describes in detail a beautiful pattern for implementing a dry-run mode for a Django management command, by executing ORM calls inside an atomic()
transaction block, showing a summary of changes that are made and then rolling the transaction back at the end.