summaryrefslogtreecommitdiff
path: root/tests/foreign_object/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/foreign_object/tests.py')
-rw-r--r--tests/foreign_object/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py
index 8b36df29d7..0bba0eaa98 100644
--- a/tests/foreign_object/tests.py
+++ b/tests/foreign_object/tests.py
@@ -297,6 +297,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