diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-02 01:49:12 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-02 01:49:12 +0000 |
| commit | 25130b9675e5a53926ad45d828460341679d49fe (patch) | |
| tree | dc21a186811488c8582d98ace416e5abd61198ae /tests/regressiontests/aggregation_regress | |
| parent | 751234bfd9afa76bafa93e17b6ed8a5d99a3010f (diff) | |
Fixed #10670: fixed reusing QuerySets previously used in a filter expression. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/aggregation_regress')
| -rw-r--r-- | tests/regressiontests/aggregation_regress/models.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py index 275ea07390..2dfa1818fc 100644 --- a/tests/regressiontests/aggregation_regress/models.py +++ b/tests/regressiontests/aggregation_regress/models.py @@ -259,6 +259,23 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta >>> Book.objects.annotate(Count('publisher')).values('publisher').count() 6 +>>> publishers = Publisher.objects.filter(id__in=(1,2)) +>>> publishers +[<Publisher: Apress>, <Publisher: Sams>] + +>>> publishers = publishers.annotate(n_books=models.Count('book')) +>>> publishers[0].n_books +2 + +>>> publishers +[<Publisher: Apress>, <Publisher: Sams>] + +>>> books = Book.objects.filter(publisher__in=publishers) +>>> books +[<Book: Practical Django Projects>, <Book: Sams Teach Yourself Django in 24 Hours>, <Book: The Definitive Guide to Django: Web Development Done Right>] + +>>> publishers +[<Publisher: Apress>, <Publisher: Sams>] """ } @@ -307,4 +324,3 @@ if settings.DATABASE_ENGINE != 'sqlite3': """ - |
