Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #20250 - Added a regression test for negated Q + annotate

Thanks nott.
  • Loading branch information...
commit 7426e72302db9c8c78235afc5c335a437a7ad760 1 parent 8a6e040
Tim Graham timgraham authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 tests/queries/tests.py
11 tests/queries/tests.py
View
@@ -1111,6 +1111,17 @@ def test_ticket19672(self):
['<Report: r1>']
)
+ def test_ticket_20250(self):
+ # A negated Q along with an annotated queryset failed in Django 1.4
+ qs = Author.objects.annotate(Count('item'))
+ qs = qs.filter(~Q(extra__value=0))
+
+ self.assertTrue('SELECT' in str(qs.query))
+ self.assertQuerysetEqual(
+ qs,
+ ['<Author: a1>', '<Author: a2>', '<Author: a3>', '<Author: a4>']
+ )
+
class Queries2Tests(TestCase):
def setUp(self):
Please sign in to comment.
Something went wrong with that request. Please try again.