db.transaction.set_rollback()

set_rollback(rollback, using=None) [source]

Setting the rollback flag to True forces a rollback when exiting the innermost atomic block. This may be useful to trigger a rollback without raising an exception.

Setting it to False prevents such a rollback. Before doing that, make sure you’ve rolled back the transaction to a known-good savepoint within the current atomic block! Otherwise you’re breaking atomicity and data corruption may occur.

doc_Django
2016-10-09 18:36:28
Comments
Leave a Comment

Please login to continue.