summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-02-19 03:12:37 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2013-02-19 03:13:13 +0200
commit4b9fa49bc0cf5d2e01b6b98dec6d23fed774f254 (patch)
tree674ed3d8d5547515c0092e73537f2b84dc1daa64
parent607772b942010d2b237c95d2ba74c958986def04 (diff)
Avoided related_name conflicts in tests
-rw-r--r--tests/regressiontests/aggregation_regress/models.py4
-rw-r--r--tests/regressiontests/aggregation_regress/tests.py10
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index b857ba62ac..047c871c39 100644
--- a/tests/regressiontests/aggregation_regress/models.py
+++ b/tests/regressiontests/aggregation_regress/models.py
@@ -24,7 +24,7 @@ class Publisher(models.Model):
return self.name
-class TaggedItem(models.Model):
+class ItemTag(models.Model):
tag = models.CharField(max_length=100)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
@@ -42,7 +42,7 @@ class Book(models.Model):
contact = models.ForeignKey(Author, related_name='book_contact_set')
publisher = models.ForeignKey(Publisher)
pubdate = models.DateField()
- tags = generic.GenericRelation(TaggedItem)
+ tags = generic.GenericRelation(ItemTag)
class Meta:
ordering = ('name',)
diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py
index 94a02cf3b5..bb1eb59b07 100644
--- a/tests/regressiontests/aggregation_regress/tests.py
+++ b/tests/regressiontests/aggregation_regress/tests.py
@@ -12,7 +12,7 @@ from django.test import TestCase, Approximate, skipUnlessDBFeature
from django.utils import six
from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook,
- TaggedItem, WithManualPK)
+ ItemTag, WithManualPK)
class AggregationTests(TestCase):
@@ -993,18 +993,18 @@ class AggregationTests(TestCase):
tests aggregations with generic reverse relations
"""
b = Book.objects.get(name='Practical Django Projects')
- TaggedItem.objects.create(object_id=b.id, tag='intermediate',
+ ItemTag.objects.create(object_id=b.id, tag='intermediate',
content_type=ContentType.objects.get_for_model(b))
- TaggedItem.objects.create(object_id=b.id, tag='django',
+ ItemTag.objects.create(object_id=b.id, tag='django',
content_type=ContentType.objects.get_for_model(b))
# 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)
- TaggedItem.objects.create(object_id=wmpk.id, tag='hi mom',
+ 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')
- TaggedItem.objects.create(object_id=b.id, tag='intermediate',
+ ItemTag.objects.create(object_id=b.id, tag='intermediate',
content_type=ContentType.objects.get_for_model(b))
self.assertEqual(Book.objects.aggregate(Count('tags')), {'tags__count': 3})