1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #25972 -- Restored support for the isnull lookup with ForeignObject.

This commit is contained in:
Tomo Otsuka
2015-12-22 23:22:54 +00:00
committed by Tim Graham
parent 91cd4d8e8c
commit 8b6974a685
5 changed files with 32 additions and 10 deletions

View File

@@ -395,6 +395,18 @@ class MultiColumnFKTests(TestCase):
objs = [Person(name="abcd_%s" % i, person_country=self.usa) for i in range(0, 5)]
Person.objects.bulk_create(objs, 10)
def test_isnull_lookup(self):
Membership.objects.create(membership_country=self.usa, person=self.bob, group_id=None)
Membership.objects.create(membership_country=self.usa, person=self.bob, group=self.cia)
self.assertQuerysetEqual(
Membership.objects.filter(group__isnull=True),
['<Membership: Bob is a member of NULL>']
)
self.assertQuerysetEqual(
Membership.objects.filter(group__isnull=False),
['<Membership: Bob is a member of CIA>']
)
class TestModelCheckTests(SimpleTestCase):