'Enters transaction management for a running thread. It must be balanced with
the appropriate leave_transaction_management call, since the actual state is
managed as a stack.
The state and dirty flag are carried over from the surrounding block or
from the settings, if there is no surrounding block (dirty is always false
when no current block is running).'

def enter_transaction_management(self, managed=True):

    if self.transaction_state:
        self.transaction_state.append(self.transaction_state[(-1)])
    else:
        self.transaction_state.append(settings.TRANSACTIONS_MANAGED)
    if (self._dirty is None):
        self._dirty = False
    self._enter_transaction_management(managed)
