From 5e485a15ad07b492e648fe784ddd136d36ffcac4 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 8 Feb 2011 14:07:14 +0000 Subject: [1.2.X] Fixed #13815 -- Ensure that reverse exclude lookups on nullable foreign keys exclude null values. Thanks to bpeschier for the report and patch. Backport of r15458 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15460 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/null_queries/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/null_queries/tests.py b/tests/regressiontests/null_queries/tests.py index 72dcd5153c..8392c588e4 100644 --- a/tests/regressiontests/null_queries/tests.py +++ b/tests/regressiontests/null_queries/tests.py @@ -67,3 +67,15 @@ class NullQueriesTests(TestCase): [''] ) + # Ticket #13815: check if _isnull=False does not produce + # faulty empty lists + objB = OuterB.objects.create(data="reverse") + self.assertQuerysetEqual( + OuterB.objects.filter(inner__isnull=False), + [] + ) + Inner.objects.create(first=obj) + self.assertQuerysetEqual( + OuterB.objects.exclude(inner__isnull=False), + [''] + ) -- cgit v1.3