summaryrefslogtreecommitdiff
path: root/tests/annotations/tests.py
diff options
context:
space:
mode:
authorPaweł Marczewski <pwmarcz@gmail.com>2015-05-24 19:05:56 +0200
committerTim Graham <timograham@gmail.com>2015-05-25 20:46:20 -0400
commit801a84ae329a24d9adf01b700429fe8f1285b2b8 (patch)
treee5688ae6ea8d0404d21c5c87857e9a8d40c9fda8 /tests/annotations/tests.py
parent4df7e8483b2679fc1cba3410f08960bac6f51115 (diff)
Fixed #24835 -- Fixed QuerySet.exists() after an annotation with Count()
QuerySet.exists() incorrectly handled query.group_by = True case (grouping by all select fields), causing GROUP BY expressions to be wiped along with select fields.
Diffstat (limited to 'tests/annotations/tests.py')
-rw-r--r--tests/annotations/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 1230d5c52a..5928266e60 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -325,6 +325,10 @@ class NonAggregateAnnotationTestCase(TestCase):
lambda a: (a['age'], a['age_count'])
)
+ def test_annotate_exists(self):
+ authors = Author.objects.annotate(c=Count('id')).filter(c__gt=1)
+ self.assertFalse(authors.exists())
+
def test_column_field_ordering(self):
"""
Test that columns are aligned in the correct order for