summaryrefslogtreecommitdiff
path: root/tests
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:47:28 -0400
commit2aa2b9f291e43bffc07c535dc5906094e6df0bb7 (patch)
tree8849922dd789b15006aca84ea05a22393a290e5f /tests
parent1ac4c7d415750ddc648cbf888bc2fbcde933f799 (diff)
[1.8.x] 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. Backport of 801a84ae329a24d9adf01b700429fe8f1285b2b8 from master
Diffstat (limited to 'tests')
-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 9e647cd3f9..c08dd84d57 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -245,6 +245,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