瀏覽代碼

Fixed #19154 - Noted commit_manually requires commit/rollback for reads

Thanks als for the report.
Tim Graham 12 年之前
父節點
當前提交
620e0bba49
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      docs/topics/db/transactions.txt

+ 6 - 2
docs/topics/db/transactions.txt

@@ -161,8 +161,12 @@ managers, too.
     transactions. It tells Django you'll be managing the transaction on your
     own.
 
-    If your view changes data and doesn't ``commit()`` or ``rollback()``,
-    Django will raise a ``TransactionManagementError`` exception.
+    Whether you are writing or simply reading from the database, you must
+    ``commit()`` or ``rollback()`` explicitly or Django will raise a
+    :exc:`TransactionManagementError` exception. This is required when reading
+    from the database because ``SELECT`` statements may call functions which
+    modify tables, and thus it is impossible to know if any data has been
+    modified.
 
     Manual transaction management looks like this::