Ticket #7872: 7872-testcase.diff

File 7872-testcase.diff, 952 bytes (added by Michael Radziej, 16 years ago)

patch with a test case

  • new file tests/regressiontests/bug7872/models.py

    diff --git a/tests/regressiontests/bug7872/__init__.py b/tests/regressiontests/bug7872/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/regressiontests/bug7872/models.py b/tests/regressiontests/bug7872/models.py
    new file mode 100644
    index 0000000..353cd57
    - +  
     1"""
     2Regression tests for #7872
     3"""
     4
     5from django.db import models
     6from django.db.models import Q
     7
     8# Mixed forward and reverse joins, #7872
     9class Ticket(models.Model):
     10  creator = models.IntegerField()
     11
     12class Group(models.Model):
     13  name = models.CharField(max_length=30)
     14
     15class Assignment(models.Model):
     16  ticket = models.ForeignKey(Ticket)
     17  group = models.ForeignKey(Group)
     18
     19
     20__test__ = {'API_TESTS':"""
     21>>> Ticket.objects.create(creator=1)
     22<Ticket: Ticket object>
     23>>> Ticket.objects.filter(Q(creator=1)|Q(assignment__group__name='fizz'))
     24<Ticket: Ticket object>
     25"""}
Back to Top