0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Improved wording in Q() docs.

This commit is contained in:
Adam Johnson 2020-05-06 05:43:28 +01:00 committed by GitHub
parent 1c2c6f1b51
commit 83c631ade7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3567,14 +3567,12 @@ elsewhere.
.. class:: Q
A ``Q()`` object, like an :class:`~django.db.models.F` object, encapsulates a
SQL expression in a Python object that can be used in database-related
operations.
In general, ``Q() objects`` make it possible to define and reuse conditions.
This permits the :ref:`construction of complex database queries
<complex-lookups-with-q>` using ``|`` (``OR``) and ``&`` (``AND``) operators;
in particular, it is not otherwise possible to use ``OR`` in ``QuerySets``.
A ``Q()`` object represents an SQL condition that can be used in
database-related operations. It's similar to how an
:class:`F() <django.db.models.F>` object represents the value of a model field
or annotation. They make it possible to define and reuse conditions, and
combine them using operators such as ``|`` (``OR``) and ``&`` (``AND``). See
:ref:`complex-lookups-with-q`.
``Prefetch()`` objects
----------------------