diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-05-16 15:11:19 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-05-17 08:39:44 +0200 |
| commit | 201d29b3719ef15637648be7bd947ef90a66ab55 (patch) | |
| tree | 57f798e90dcbfd8b0cdfc588a3d0c52837be33d5 /tests | |
| parent | 9c301814b0d342bfc5f10c1513594ce5fbb6c6a9 (diff) | |
[4.2.x] 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.
Backport of 99e5dff737cd20b12d060e4794e097063b61ec40 from main
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/defer_regress/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py index 9f94d5fac1..ab2be085c6 100644 --- a/tests/defer_regress/tests.py +++ b/tests/defer_regress/tests.py @@ -296,6 +296,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] |
