Fixed #11320 -- exclude() too aggressive in join promotion

This commit is contained in:
Anssi Kääriäinen 2013-11-05 19:26:59 +02:00
parent 6fe2b001db
commit e7b61e5717
1 changed files with 4 additions and 0 deletions

View File

@ -1797,6 +1797,10 @@ class Queries6Tests(TestCase):
q1 = Tag.objects.order_by('name') q1 = Tag.objects.order_by('name')
self.assertIsNot(q1, q1.all()) self.assertIsNot(q1, q1.all())
def test_ticket_11320(self):
qs = Tag.objects.exclude(category=None).exclude(category__name='foo')
self.assertEqual(str(qs.query).count(' INNER JOIN '), 1)
class RawQueriesTests(TestCase): class RawQueriesTests(TestCase):
def setUp(self): def setUp(self):