code: def commit_on_success(using=None):
      
      def entering(using):
          enter_transaction_management(using=using)
  
      def exiting(exc_value, using):
          try:
              if exc_value is not None:
                  if is_dirty(using=using):
                      rollback(using=using)
              else:
                  commit(using=using)
          finally:
              leave_transaction_management(using=using)
  
      return _transaction_func(entering, exiting, using)
docs: This decorator activates commit on response. This way, if the view function
      runs successfully, a commit is made; if the viewfunc produces an exception,
      a rollback is made. This is one of the most common ways to do transaction
      control in Web apps.