Ok so I am very familiar with django transactions inside of views and pre-1.5 you just had to add the decorator @transaction.commit_on_success
. This worked on views AND on standalone scripts. When we updated to 1.6 I just commented all of these out if they were not in a view. I found that if you had a standalone script using @transaction.atomic it all blew up (nothing actually saves to the database). So I now have a pretty big need to get this working again after just disabling it. All the docs simply refer to transactions in a view and give no instruction on what to do if you are using django outside a view!
So far I have tried:
- Turning off autocommit (I'm using postgres)
- Creating savepoints
- Using atomic
None of these work. Is the only solution to run raw SQL to begin and commit a transaction?
Any good examples in stack overflow also exclusively deal with views or did not have any answers.