From 99e5dff737cd20b12d060e4794e097063b61ec40 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Tue, 16 May 2023 15:11:19 -0400 Subject: Fixed #34570 -- Silenced noop deferral of many-to-many and GFK. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While deferring many-to-many and GFK has no effect, the previous implementation of QuerySet.defer() ignore them instead of crashing. Regression in b3db6c8dcb5145f7d45eff517bcd96460475c879. Thanks Paco Martínez for the report. --- tests/defer_regress/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py index 33193e187a..fc2d87e12b 100644 --- a/tests/defer_regress/tests.py +++ b/tests/defer_regress/tests.py @@ -271,6 +271,12 @@ class DeferRegressionTest(TestCase): with self.assertNumQueries(1): self.assertEqual(leaf.second_child.value, 64) + def test_defer_many_to_many_ignored(self): + location = Location.objects.create() + request = Request.objects.create(location=location) + with self.assertNumQueries(1): + self.assertEqual(Request.objects.defer("items").get(), request) + class DeferDeletionSignalsTests(TestCase): senders = [Item, Proxy] -- cgit v1.3