mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
[1.7.x] Fixed #22343 -- Disallowed select_for_update in autocommit mode
The ticket was originally about two failing tests, which are fixed by putting their queries in transactions. Thanks Tim Graham for the report, Aymeric Augustin for the fix, and Simon Charette, Tim Graham & Loïc Bistuer for review. Backport of b990df1d63 from master
This commit is contained in:
@@ -722,7 +722,10 @@ Select for update
|
||||
If you were relying on "automatic transactions" to provide locking between
|
||||
:meth:`~django.db.models.query.QuerySet.select_for_update` and a subsequent
|
||||
write operation — an extremely fragile design, but nonetheless possible — you
|
||||
must wrap the relevant code in :func:`atomic`.
|
||||
must wrap the relevant code in :func:`atomic`. Since Django 1.6.3, executing
|
||||
a query with :meth:`~django.db.models.query.QuerySet.select_for_update` in
|
||||
autocommit mode will raise a
|
||||
:exc:`~django.db.transaction.TransactionManagementError`.
|
||||
|
||||
Using a high isolation level
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user