summaryrefslogtreecommitdiff
path: root/tests/regressiontests/aggregation_regress/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regressiontests/aggregation_regress/models.py')
-rw-r--r--tests/regressiontests/aggregation_regress/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index d7dd7617e6..3e5f873472 100644
--- a/tests/regressiontests/aggregation_regress/models.py
+++ b/tests/regressiontests/aggregation_regress/models.py
@@ -194,6 +194,11 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, id, i
>>> Book.objects.annotate(num_authors=Count('authors')).order_by('publisher__name', 'name')
[<Book: Practical Django Projects>, <Book: The Definitive Guide to Django: Web Development Done Right>, <Book: Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp>, <Book: Artificial Intelligence: A Modern Approach>, <Book: Python Web Development with Django>, <Book: Sams Teach Yourself Django in 24 Hours>]
+# Regression for #10127 - Empty select_related() works with annotate
+>>> books = Book.objects.all().filter(rating__lt=4.5).select_related().annotate(Avg('authors__age'))
+>>> sorted([(b.name, b.authors__age__avg) for b in books])
+[(u'Artificial Intelligence: A Modern Approach', 51.5), (u'Practical Django Projects', 29.0), (u'Python Web Development with Django', 30.3...), (u'Sams Teach Yourself Django in 24 Hours', 45.0)]
+
"""
}