summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2023-05-16 15:11:19 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-05-17 08:06:11 +0200
commit99e5dff737cd20b12d060e4794e097063b61ec40 (patch)
treeec5fadc1ec5d0972f879d6b22ca38a2856457aa7 /tests
parent0ec60661e61b153e6bcec64649b1b7f524eb3e18 (diff)
Fixed #34570 -- Silenced noop deferral of many-to-many and GFK.
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/defer_regress/tests.py6
1 files changed, 6 insertions, 0 deletions
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]