mirror of https://github.com/django/django.git
Fixed #20250 - Added a regression test for negated Q + annotate
Thanks nott.
This commit is contained in:
parent
8a6e040bfa
commit
7426e72302
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue