1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34612 -- Fixed QuerySet.only() crash on reverse relationships.

Regression in b3db6c8dcb.

Thanks Ian Cubitt for the report.

This also corrected test_inheritance_deferred2() test which was
previously properly defined and marked as an expected failure but was
then wrongly adjusted to mask the lack of support for per-alias
deferral that was fixed by #21204.
This commit is contained in:
Simon Charette
2023-05-31 18:04:17 -04:00
committed by Mariusz Felisiak
parent d9e7018796
commit 2cf76f2d5d
4 changed files with 23 additions and 1 deletions

View File

@@ -249,6 +249,9 @@ class ReverseSelectRelatedTestCase(TestCase):
self.assertEqual(p.child1.name2, "n2")
p = qs.get(name2="n2")
with self.assertNumQueries(0):
self.assertEqual(p.child1.value, 1)
self.assertEqual(p.child1.child4.value4, 4)
with self.assertNumQueries(2):
self.assertEqual(p.child1.name1, "n1")
self.assertEqual(p.child1.child4.name1, "n1")