summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-09-23 18:18:20 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2013-09-25 20:50:48 +0300
commitd7ae0bc372f8423e7bcf9b5408df46fd5c8dc27d (patch)
tree410abca809582026c7dd85e45aac76577c768fbd /tests
parent5207928151938114cea3ca2d56990e10bf3e8544 (diff)
[1.6.x] Fixed #21126 -- QuerySet value conversion failure
A .annotate().select_related() query resulted in misaligned rows vs columns for compiler.resolve_columns() method. Report & patch by Michael Manfre. Backpatch of 83554b018ef283827c0e7459ab934d447b3419d5 from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/aggregation_regress/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 1f1561351f..f0d1e59f3c 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -387,6 +387,17 @@ class AggregationTests(TestCase):
qs = Entries.objects.annotate(clue_count=Count('clues__ID'))
self.assertQuerysetEqual(qs, [])
+ def test_boolean_conversion(self):
+ # Aggregates mixed up ordering of columns for backend's convert_values
+ # method. Refs #21126.
+ e = Entries.objects.create(Entry='foo')
+ c = Clues.objects.create(EntryID=e, Clue='bar')
+ qs = Clues.objects.select_related('EntryID').annotate(Count('ID'))
+ self.assertQuerysetEqual(
+ qs, [c], lambda x: x)
+ self.assertEqual(qs[0].EntryID, e)
+ self.assertIs(qs[0].EntryID.Exclude, False)
+
def test_empty(self):
# Regression for #10089: Check handling of empty result sets with
# aggregates