summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2023-04-04 16:58:15 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-04-05 06:06:03 +0200
commit647920b76694526c6be0375ff22e4d6ee43c9580 (patch)
tree0e45be7d81ad842b3e3e48f4e126f3255246ece1 /tests
parent272dc386c28a4999b179de8ed57bcddea09676a7 (diff)
[4.2.x] Fixed #34458 -- Fixed QuerySet.defer() crash on attribute names.
Thanks Andrew Cordery for the report. Regression in b3db6c8dcb5145f7d45eff517bcd96460475c879. Backport of 87c63bd8df0eb0109df333df1264c6a96707d6a4 from main
Diffstat (limited to 'tests')
-rw-r--r--tests/defer/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/defer/tests.py b/tests/defer/tests.py
index 34544b4bef..c7eb03dc8a 100644
--- a/tests/defer/tests.py
+++ b/tests/defer/tests.py
@@ -178,6 +178,11 @@ class DeferTests(AssertionMixin, TestCase):
obj = ShadowChild.objects.defer("name").get()
self.assertEqual(obj.name, "adonis")
+ def test_defer_fk_attname(self):
+ primary = Primary.objects.defer("related_id").get()
+ with self.assertNumQueries(1):
+ self.assertEqual(primary.related_id, self.p1.related_id)
+
class BigChildDeferTests(AssertionMixin, TestCase):
@classmethod