diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-24 09:25:32 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-24 09:25:32 +0000 |
| commit | c57fe6c3ece9f47778d7e00533b7d278e3e516f1 (patch) | |
| tree | afeba05d9a6f27b71ceb9876df195584b1d6480f /docs | |
| parent | cbe11c1982b5519171a8caae6f99629899dc929b (diff) | |
Fixed #9432 -- Revived documentation of ~Q usage.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/queries.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index 0bb4a9c13c..43daff4a3e 100644 --- a/docs/topics/db/queries.txt +++ b/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 |
