Fixed #20788 -- exclude() generated subquery failure
"Fixed" by adding a test case, the original problem was already fixed by earlier ORM changes. Thanks to david@judicata.com for the report and test case.
This commit is contained in:
parent
4bd5554721
commit
c00a8525c6
|
@ -2910,7 +2910,7 @@ class DoubleInSubqueryTests(TestCase):
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
qs, [lfb1], lambda x: x)
|
qs, [lfb1], lambda x: x)
|
||||||
|
|
||||||
class Ticket18785Tests(unittest.TestCase):
|
class Ticket18785Tests(TestCase):
|
||||||
def test_ticket_18785(self):
|
def test_ticket_18785(self):
|
||||||
# Test join trimming from ticket18785
|
# Test join trimming from ticket18785
|
||||||
qs = Item.objects.exclude(
|
qs = Item.objects.exclude(
|
||||||
|
@ -2920,3 +2920,22 @@ class Ticket18785Tests(unittest.TestCase):
|
||||||
).order_by()
|
).order_by()
|
||||||
self.assertEqual(1, str(qs.query).count('INNER JOIN'))
|
self.assertEqual(1, str(qs.query).count('INNER JOIN'))
|
||||||
self.assertEqual(0, str(qs.query).count('OUTER JOIN'))
|
self.assertEqual(0, str(qs.query).count('OUTER JOIN'))
|
||||||
|
|
||||||
|
|
||||||
|
class Ticket20788Tests(TestCase):
|
||||||
|
def test_ticket_20788(self):
|
||||||
|
Paragraph.objects.create()
|
||||||
|
paragraph = Paragraph.objects.create()
|
||||||
|
page = paragraph.page.create()
|
||||||
|
chapter = Chapter.objects.create(paragraph=paragraph)
|
||||||
|
Book.objects.create(chapter=chapter)
|
||||||
|
|
||||||
|
paragraph2 = Paragraph.objects.create()
|
||||||
|
Page.objects.create()
|
||||||
|
chapter2 = Chapter.objects.create(paragraph=paragraph2)
|
||||||
|
book2 = Book.objects.create(chapter=chapter2)
|
||||||
|
|
||||||
|
sentences_not_in_pub = Book.objects.exclude(
|
||||||
|
chapter__paragraph__page=page)
|
||||||
|
self.assertQuerysetEqual(
|
||||||
|
sentences_not_in_pub, [book2], lambda x: x)
|
||||||
|
|
Loading…
Reference in New Issue