1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Fixed #36290 -- Made TupleIn() lookup discard tuples containing None.

Just like the In() lookup discards of None members TupleIn() should
discard tuples containing any None as NULL != NULL in SQL and the
framework expects such queries to be elided under some circumstances.

Refs #31667, #36116.

Thanks Basptise Mispelon for bisecting the regression to 626d77e.
This commit is contained in:
Simon Charette
2025-04-02 13:32:38 -04:00
committed by Mariusz Felisiak
parent 543e17c440
commit f7f38f3a0b
5 changed files with 37 additions and 1 deletions

View File

@@ -296,6 +296,19 @@ class MultiColumnFKTests(TestCase):
self.assertEqual(friendships[0].to_friend, self.george)
self.assertEqual(friendships[1].to_friend, self.sam)
def test_prefetch_foreignobject_null_hidden_forward_skipped(self):
fiendship = Friendship.objects.create(
from_friend_country=self.usa,
from_friend_id=self.bob.id,
to_friend_country_id=self.usa.id,
to_friend_id=None,
)
with self.assertNumQueries(1):
self.assertEqual(
Friendship.objects.prefetch_related("to_friend").get(),
fiendship,
)
def test_prefetch_foreignobject_reverse(self):
Membership.objects.create(
membership_country=self.usa, person=self.bob, group=self.cia