MCPcopy
hub / github.com/django/django / select_for_update

Method select_for_update

django/db/models/query.py:1740–1754  ·  view source on GitHub ↗

Return a new QuerySet instance that will select objects with a FOR UPDATE lock.

(self, nowait=False, skip_locked=False, of=(), no_key=False)

Source from the content-addressed store, hash-verified

1738 return self._combinator_query("difference", *other_qs)
1739
1740 def select_for_update(self, nowait=False, skip_locked=False, of=(), no_key=False):
1741 """
1742 Return a new QuerySet instance that will select objects with a
1743 FOR UPDATE lock.
1744 """
1745 if nowait and skip_locked:
1746 raise ValueError("The nowait option cannot be used with skip_locked.")
1747 obj = self._chain()
1748 obj._for_write = True
1749 obj.query.select_for_update = True
1750 obj.query.select_for_update_nowait = nowait
1751 obj.query.select_for_update_skip_locked = skip_locked
1752 obj.query.select_for_update_of = of
1753 obj.query.select_for_no_key_update = no_key
1754 return obj
1755
1756 def select_related(self, *fields):
1757 """

Calls 1

_chainMethod · 0.95