diff options
Diffstat (limited to 'tests/aggregation_regress/tests.py')
| -rw-r--r-- | tests/aggregation_regress/tests.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 9fcaefe6f5..111ef79b5e 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -1017,20 +1017,20 @@ class AggregationTests(TestCase): tests aggregations with generic reverse relations """ - b = Book.objects.get(name='Practical Django Projects') - ItemTag.objects.create(object_id=b.id, tag='intermediate', - content_type=ContentType.objects.get_for_model(b)) - ItemTag.objects.create(object_id=b.id, tag='django', - content_type=ContentType.objects.get_for_model(b)) + django_book = Book.objects.get(name='Practical Django Projects') + ItemTag.objects.create(object_id=django_book.id, tag='intermediate', + content_type=ContentType.objects.get_for_model(django_book)) + ItemTag.objects.create(object_id=django_book.id, tag='django', + content_type=ContentType.objects.get_for_model(django_book)) # Assign a tag to model with same PK as the book above. If the JOIN # used in aggregation doesn't have content type as part of the # condition the annotation will also count the 'hi mom' tag for b. - wmpk = WithManualPK.objects.create(id=b.pk) + wmpk = WithManualPK.objects.create(id=django_book.pk) ItemTag.objects.create(object_id=wmpk.id, tag='hi mom', content_type=ContentType.objects.get_for_model(wmpk)) - b = Book.objects.get(name__startswith='Paradigms of Artificial Intelligence') - ItemTag.objects.create(object_id=b.id, tag='intermediate', - content_type=ContentType.objects.get_for_model(b)) + ai_book = Book.objects.get(name__startswith='Paradigms of Artificial Intelligence') + ItemTag.objects.create(object_id=ai_book.id, tag='intermediate', + content_type=ContentType.objects.get_for_model(ai_book)) self.assertEqual(Book.objects.aggregate(Count('tags')), {'tags__count': 3}) results = Book.objects.annotate(Count('tags')).order_by('-tags__count', 'name') |
