From 789c47e6de70ca8249aceac83d629c5d38070e45 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 3 Nov 2020 21:31:57 -0500 Subject: [PATCH] Removed hardcoded pk in defer_regress test. --- tests/defer_regress/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py index 314584abb4f..ccd6556c80f 100644 --- a/tests/defer_regress/tests.py +++ b/tests/defer_regress/tests.py @@ -121,13 +121,13 @@ class DeferRegressionTest(TestCase): list) def test_ticket_23270(self): - Derived.objects.create(text="foo", other_text="bar") + d = Derived.objects.create(text="foo", other_text="bar") with self.assertNumQueries(1): obj = Base.objects.select_related("derived").defer("text")[0] self.assertIsInstance(obj.derived, Derived) self.assertEqual("bar", obj.derived.other_text) self.assertNotIn("text", obj.__dict__) - self.assertEqual(1, obj.derived.base_ptr_id) + self.assertEqual(d.pk, obj.derived.base_ptr_id) def test_only_and_defer_usage_on_proxy_models(self): # Regression for #15790 - only() broken for proxy models