'Commits and leaves transaction management.'

def process_response(self, request, response):

    if (not transaction.get_autocommit()):
        if transaction.is_dirty():
            try:
                transaction.commit()
            except Exception:
                transaction.rollback()
                transaction.leave_transaction_management()
                raise
        transaction.leave_transaction_management()
    return response
