I read the chapter in the Django docs about the transaction management. From what I understand, the transaction is started as soon as TransactionMiddleware
is invoked. Then by using @commit_on_success
, @commit_manually
there is a possibility of controlling transaction ending.
My question: is there a possibility to control transaction beginning as well without getting rid of TransactionMiddleware altogether. My concern is that many parts of Django framework actually depend on TransactionMiddleware presence, so I don't really want to break it. I'd like it to be used for all the views except for those that belong to the applications that I explicitly specify. Most of all I'd like to be able to control transactional behaviour for certain group of views totally - from the beginning until the end. What approach should I take? Are there any external apps, libraries to help me out? Are transactions created eagerly or lazily - as soon as the first database hit occurs?