diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2006-05-26 23:41:43 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2006-05-26 23:41:43 +0000 |
| commit | 60c3e55b1f7c87ef9fa7c5ffdaf6e8dba5ab7043 (patch) | |
| tree | 9ec66b08e4962b8ec67246418bf6a147a7057244 /tests | |
| parent | c3baf4668f655758b5251c048f740c5489104380 (diff) | |
Fixed bug with QuerySet.exclude() failing to do negations on Q objects, and
at the same time generalised exclude/QNot so that they work for 'external'
Q objects i.e. ones that simply have 'get_sql' defined.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/or_lookups/models.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/modeltests/or_lookups/models.py b/tests/modeltests/or_lookups/models.py index a07dacdd5a..ef4d4dc5ca 100644 --- a/tests/modeltests/or_lookups/models.py +++ b/tests/modeltests/or_lookups/models.py @@ -89,6 +89,10 @@ Hello and goodbye >>> Article.objects.filter(Q(headline__startswith='Hello')).in_bulk([1,2]) {1: Hello} +# Demonstrating exclude with a Q object +>>> Article.objects.exclude(Q(headline__startswith='Hello')) +[Goodbye] + # The 'complex_filter' method supports framework features such as # 'limit_choices_to' which normally take a single dictionary of lookup arguments # but need to support arbitrary queries via Q objects too. |
