浏览代码

[5.0.x] Refs #22936 -- Doc'd Lookup.prepare_rhs.

Backport of 91cb2d0b487acc56d886612a7251b9ba555d71b4 from main
Mariusz Felisiak 1 年之前
父节点
当前提交
6e7c8cc42e
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      docs/ref/models/lookups.txt

+ 8 - 0
docs/ref/models/lookups.txt

@@ -218,6 +218,14 @@ following methods:
         The name of this lookup, used to identify it on parsing query
         expressions. It cannot contain the string ``"__"``.
 
+    .. attribute:: prepare_rhs
+
+        Defaults to ``True``. When :attr:`rhs` is a plain value,
+        :attr:`prepare_rhs` determines whether it should be prepared for use as
+        a parameter in a query. In order to do so,
+        ``lhs.output_field.get_prep_value()`` is called if defined, or ``rhs``
+        is wrapped in :class:`Value() <django.db.models.Value>` otherwise.
+
     .. method:: process_lhs(compiler, connection, lhs=None)
 
         Returns a tuple ``(lhs_string, lhs_params)``, as returned by