mirror of
https://github.com/django/django.git
synced 2025-08-19 02:01:29 +00:00
[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 801a84ae32
from master
This commit is contained in:
parent
1ac4c7d415
commit
2aa2b9f291
3 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue