Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Avoided related_name conflicts in tests

  • Loading branch information...
commit 4b9fa49bc0cf5d2e01b6b98dec6d23fed774f254 1 parent 607772b
Anssi Kääriäinen authored February 19, 2013
4  tests/regressiontests/aggregation_regress/models.py
@@ -24,7 +24,7 @@ def __str__(self):
24 24
         return self.name
25 25
 
26 26
 
27  
-class TaggedItem(models.Model):
  27
+class ItemTag(models.Model):
28 28
     tag = models.CharField(max_length=100)
29 29
     content_type = models.ForeignKey(ContentType)
30 30
     object_id = models.PositiveIntegerField()
@@ -42,7 +42,7 @@ class Book(models.Model):
42 42
     contact = models.ForeignKey(Author, related_name='book_contact_set')
43 43
     publisher = models.ForeignKey(Publisher)
44 44
     pubdate = models.DateField()
45  
-    tags = generic.GenericRelation(TaggedItem)
  45
+    tags = generic.GenericRelation(ItemTag)
46 46
 
47 47
     class Meta:
48 48
         ordering = ('name',)
10  tests/regressiontests/aggregation_regress/tests.py
@@ -12,7 +12,7 @@
12 12
 from django.utils import six
13 13
 
14 14
 from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook,
15  
-        TaggedItem, WithManualPK)
  15
+        ItemTag, WithManualPK)
16 16
 
17 17
 
18 18
 class AggregationTests(TestCase):
@@ -993,18 +993,18 @@ def test_aggregation_with_generic_reverse_relation(self):
993 993
         tests aggregations with generic reverse relations
994 994
         """
995 995
         b = Book.objects.get(name='Practical Django Projects')
996  
-        TaggedItem.objects.create(object_id=b.id, tag='intermediate',
  996
+        ItemTag.objects.create(object_id=b.id, tag='intermediate',
997 997
                 content_type=ContentType.objects.get_for_model(b))
998  
-        TaggedItem.objects.create(object_id=b.id, tag='django',
  998
+        ItemTag.objects.create(object_id=b.id, tag='django',
999 999
                 content_type=ContentType.objects.get_for_model(b))
1000 1000
         # Assign a tag to model with same PK as the book above. If the JOIN
1001 1001
         # used in aggregation doesn't have content type as part of the
1002 1002
         # condition the annotation will also count the 'hi mom' tag for b.
1003 1003
         wmpk = WithManualPK.objects.create(id=b.pk)
1004  
-        TaggedItem.objects.create(object_id=wmpk.id, tag='hi mom',
  1004
+        ItemTag.objects.create(object_id=wmpk.id, tag='hi mom',
1005 1005
                 content_type=ContentType.objects.get_for_model(wmpk))
1006 1006
         b = Book.objects.get(name__startswith='Paradigms of Artificial Intelligence')
1007  
-        TaggedItem.objects.create(object_id=b.id, tag='intermediate',
  1007
+        ItemTag.objects.create(object_id=b.id, tag='intermediate',
1008 1008
                 content_type=ContentType.objects.get_for_model(b))
1009 1009
 
1010 1010
         self.assertEqual(Book.objects.aggregate(Count('tags')), {'tags__count': 3})

0 notes on commit 4b9fa49

Please sign in to comment.
Something went wrong with that request. Please try again.