summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2011-01-26 03:52:41 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2011-01-26 03:52:41 +0000
commit4cee764a4621c210bd1ddbc2b4b7d29c09ce8de5 (patch)
tree8071d769077561a453d2b9443396e7f0de0d5b01 /tests/regressiontests
parent1418c215f4b6d30e58626bcb028201b016494cb0 (diff)
[1.2.X] Fixed #13159 -- properly quote aggregates in order_by. Backport of [15318].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/aggregation_regress/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py
index 822785b7a5..44c79c36c1 100644
--- a/tests/regressiontests/aggregation_regress/tests.py
+++ b/tests/regressiontests/aggregation_regress/tests.py
@@ -768,6 +768,18 @@ class AggregationTests(TestCase):
attrgetter("name")
)
+ def test_quoting_aggregate_order_by(self):
+ qs = Book.objects.filter(
+ name="Python Web Development with Django"
+ ).annotate(
+ authorCount=Count("authors")
+ ).order_by("authorCount")
+ self.assertQuerysetEqual(
+ qs, [
+ ("Python Web Development with Django", 3),
+ ],
+ lambda b: (b.name, b.authorCount)
+ )
if run_stddev_tests():
def test_stddev(self):