diff options
| author | Adam Johnson <me@adamj.eu> | 2024-11-30 08:03:55 +0000 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-12-02 16:01:37 +0100 |
| commit | 2f6b096b83c55317c7ceef2d8d5dc3bee33293dc (patch) | |
| tree | 7d17909df90c690f26dcda0eaa6b7fb0b54fd35b /tests/defer | |
| parent | 32b9e00b0c74b3af77c25215e2e2d1254b995355 (diff) | |
Fixed #35950 -- Restored refreshing of relations when fields deferred.
Thank you to Simon Charette and Sarah Boyce for the review.
Regression in 73df8b54a2fab53bec4c7573cda5ad8c869c2fd8.
Diffstat (limited to 'tests/defer')
| -rw-r--r-- | tests/defer/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/defer/tests.py b/tests/defer/tests.py index 3945b667ba..989b5c63d7 100644 --- a/tests/defer/tests.py +++ b/tests/defer/tests.py @@ -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): |
