def rollback_unless_managed(using=None):
 if (using is None):
  using = DEFAULT_DB_ALIAS
 connection = connections[using]
 if (not is_managed(using=using)):
  connection._rollback()
 else:
  set_dirty(using=using)

def rollback_unless_managed ( using = None ) : if ( using is None ) : using = DEFAULT_DB_ALIAS connection = connections [ using ] if ( not is_managed ( using = using ) ) : connection . _rollback ( ) else : set_dirty ( using = using )
rolls back changes if the system is not in managed transaction mode .