1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

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

Thanks nott.
This commit is contained in:
Tim Graham 2013-05-29 08:48:02 -04:00
parent 8a6e040bfa
commit 7426e72302

View File

@ -1111,6 +1111,17 @@ class Queries1Tests(BaseQuerysetTest):
['<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):