Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.0.X] Fixed #9432 -- Revived documentation of ~Q usage.

Backport of r9267 from trunk.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 8613e6c commit 13d810efe4cfc935cf27b884332db97031ba041f @malcolmt malcolmt committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 docs/topics/db/queries.txt
6 docs/topics/db/queries.txt
@@ -601,7 +601,11 @@ This is equivalent to the following SQL ``WHERE`` clause::
WHERE question LIKE 'Who%' OR question LIKE 'What%'
You can compose statements of arbitrary complexity by combining ``Q`` objects
-with the ``&`` and ``|`` operators. You can also use parenthetical grouping.
+with the ``&`` and ``|`` operators and use parenthetical grouping. Also, ``Q``
+objects can be negated using the ``~`` operator, allowing for combined lookups
+that combine both a normal query and a negated (``NOT``) query::
+ Q(question__startswith='Who') | ~Q(pub_date__year=2005)
Each lookup function that takes keyword-arguments (e.g. ``filter()``,
``exclude()``, ``get()``) can also be passed one or more ``Q`` objects as

0 comments on commit 13d810e

Please sign in to comment.
Something went wrong with that request. Please try again.