mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #35950 -- Restored refreshing of relations when fields deferred.
Thank you to Simon Charette and Sarah Boyce for the review.
Regression in 73df8b54a2.
This commit is contained in:
committed by
Sarah Boyce
parent
32b9e00b0c
commit
2f6b096b83
@@ -290,6 +290,14 @@ class TestDefer2(AssertionMixin, TestCase):
|
||||
self.assertEqual(rf2.name, "new foo")
|
||||
self.assertEqual(rf2.value, "new bar")
|
||||
|
||||
def test_refresh_when_one_field_deferred(self):
|
||||
s = Secondary.objects.create()
|
||||
PrimaryOneToOne.objects.create(name="foo", value="bar", related=s)
|
||||
s = Secondary.objects.defer("first").get()
|
||||
p_before = s.primary_o2o
|
||||
s.refresh_from_db()
|
||||
self.assertIsNot(s.primary_o2o, p_before)
|
||||
|
||||
|
||||
class InvalidDeferTests(SimpleTestCase):
|
||||
def test_invalid_defer(self):
|
||||
|
||||
Reference in New Issue
Block a user