Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #12567 -- Incorrect SQL in model inheritance case

An isnull lookup produced incorrect SQL. This was already fixed
earlier, so only tests added.
  • Loading branch information...
commit 630b9df42f771e90d9beb1766d4e7aa2107bd82d 1 parent 3844089
@akaariai akaariai authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/model_inheritance/tests.py
View
24 tests/model_inheritance/tests.py
@@ -323,3 +323,27 @@ def test_eq(self):
# Equality doesn't transfer in multitable inheritance.
self.assertNotEqual(Place(id=1), Restaurant(id=1))
self.assertNotEqual(Restaurant(id=1), Place(id=1))
+
+ def test_ticket_12567(self):
+ r = Restaurant.objects.create(name='n1', address='a1')
+ s = Supplier.objects.create(name='s1', address='a2')
+ self.assertQuerysetEqual(
+ Place.objects.filter(supplier__isnull=False),
+ [Place.objects.get(pk=s.pk)],
+ lambda x: x
+ )
+ self.assertQuerysetEqual(
+ Place.objects.filter(supplier__isnull=True),
+ [Place.objects.get(pk=r.pk)],
+ lambda x: x
+ )
+ self.assertQuerysetEqual(
+ Place.objects.exclude(supplier__isnull=False),
+ [Place.objects.get(pk=r.pk)],
+ lambda x: x
+ )
+ self.assertQuerysetEqual(
+ Place.objects.exclude(supplier__isnull=True),
+ [Place.objects.get(pk=s.pk)],
+ lambda x: x
+ )
Please sign in to comment.
Something went wrong with that request. Please try again.