diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-02 07:57:19 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-02 07:58:04 +0100 |
| commit | f4ed6800bd5de576816861931699ddd8377d338d (patch) | |
| tree | 96564db66230939682c37c7e511925e257dd0249 /docs/ref/models | |
| parent | ca9144a4a810dd509e468699c13325d8a1f5dcb1 (diff) | |
[3.0.x] Fixed #30953 -- Made select_for_update() lock queryset's model when using "self" with multi-table inheritance.
Thanks Abhijeet Viswa for the report and initial patch.
Backport of 0107e3d1058f653f66032f7fd3a0bd61e96bf782 from master
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/querysets.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 4e12ecabe3..a63829b088 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1692,6 +1692,14 @@ specify the related objects you want to lock in ``select_for_update(of=(...))`` using the same fields syntax as :meth:`select_related`. Use the value ``'self'`` to refer to the queryset's model. +.. admonition:: Lock parents models in ``select_for_update(of=(...))`` + + If you want to lock parents models when using :ref:`multi-table inheritance + <multi-table-inheritance>`, you must specify parent link fields (by default + ``<parent_model_name>_ptr``) in the ``of`` argument. For example:: + + Restaurant.objects.select_for_update(of=('self', 'place_ptr')) + You can't use ``select_for_update()`` on nullable relations:: >>> Person.objects.select_related('hometown').select_for_update() |
