diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 16583e8..7f0eb63 100644
a
|
b
|
class BaseA(models.Model):
|
439 | 439 | a = models.ForeignKey(FK1, null=True) |
440 | 440 | b = models.ForeignKey(FK2, null=True) |
441 | 441 | c = models.ForeignKey(FK3, null=True) |
| 442 | |
| 443 | class Identifier(models.Model): |
| 444 | name = models.TextField() |
| 445 | |
| 446 | def __unicode__(self): |
| 447 | return self.name |
| 448 | |
| 449 | class Program(models.Model): |
| 450 | identifier = models.OneToOneField(Identifier) |
| 451 | |
| 452 | class Channel(models.Model): |
| 453 | programs = models.ManyToManyField(Program) |
| 454 | identifier = models.OneToOneField(Identifier) |
diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py
index ea54d18..4d688eb 100644
a
|
b
|
class DisjunctionPromotionTests(TestCase):
|
2612 | 2612 | qs = BaseA.objects.filter(Q(a__f1=F('c__f1')) | (Q(pk=1) & Q(pk=2))) |
2613 | 2613 | self.assertEqual(str(qs.query).count('LEFT OUTER JOIN'), 2) |
2614 | 2614 | self.assertEqual(str(qs.query).count('INNER JOIN'), 0) |
| 2615 | |
| 2616 | from .models import Identifier,Program, Channel |
| 2617 | |
| 2618 | class ManyToManyExcludeTest(TestCase): |
| 2619 | def test_exclude_many_to_many(self): |
| 2620 | Identifier.objects.create(name='extra') |
| 2621 | program = Program.objects.create(identifier=Identifier.objects.create(name='program')) |
| 2622 | channel = Channel.objects.create(identifier=Identifier.objects.create(name='channel')) |
| 2623 | channel.programs.add(program) |
| 2624 | |
| 2625 | # channel contains 'program1', so all Identifiers except that one |
| 2626 | # should be returned |
| 2627 | self.assertQuerysetEqual( |
| 2628 | Identifier.objects.exclude(program__channel=channel).order_by('name'), |
| 2629 | ['<Identifier: channel>', '<Identifier: extra>'] |
| 2630 | ) |