Ticket #16055: 16055-test.diff

File 16055-test.diff, 1.7 KB (added by Tim Graham, 9 years ago)
  • tests/generic_relations_regress/models.py

    diff --git a/tests/generic_relations_regress/models.py b/tests/generic_relations_regress/models.py
    index 331c575..ac97419 100644
    a b class Person(models.Model):  
    6161
    6262
    6363class CharLink(models.Model):
     64    title = models.CharField(max_length=20)
    6465    content_type = models.ForeignKey(ContentType, models.CASCADE)
    6566    object_id = models.CharField(max_length=100)
    6667    content_object = GenericForeignKey()
    6768
    6869
    6970class TextLink(models.Model):
     71    title = models.CharField(max_length=20)
    7072    content_type = models.ForeignKey(ContentType, models.CASCADE)
    7173    object_id = models.TextField()
    7274    content_object = GenericForeignKey()
  • tests/generic_relations_regress/tests.py

    diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py
    index b6782fe..8861653 100644
    a b class GenericRelationTests(TestCase):  
    5050        TextLink.objects.create(content_object=oddrel)
    5151        oddrel.delete()
    5252
     53    def test_charlink_filter(self):
     54        # Regression for #16055
     55        oddrel = OddRelation1.objects.create(name='clink')
     56        cl = CharLink.objects.create(content_object=oddrel, title='title')
     57        list(OddRelation1.objects.filter(clinks__title='title'))
     58
     59    def test_textlink_filter(self):
     60        # Regression for #16055
     61        oddrel = OddRelation2.objects.create(name='tlink')
     62        tl = TextLink.objects.create(content_object=oddrel, title='title')
     63        list(OddRelation2.objects.filter(tlinks__title='title'))
     64
    5365    def test_q_object_or(self):
    5466        """
    5567        Tests that SQL query parameters for generic relations are properly
Back to Top