#33970: select_for_update code snippet example selects for update outside of
it's
transaction
-------------------------------+--------------------------------------
Reporter: thomasf | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 4.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => invalid
Comment:
Querysets are lazy, so:
{{{
entries = Entry.objects.select_for_update().filter(author=request.user)
}}}
doesn't evaluate it. It's evaluated when we iterate over `entries`. Also,
`select_for_update()` raises `TransactionManagementError` when you'll try
to evaluate it outside of transaction.
--
Ticket URL: <https://code.djangoproject.com/ticket/33970#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070182f2a5d51c-1db04f1c-b41b-49af-901e-575c395b9a55-000000%40eu-central-1.amazonses.com.