diff options
| author | Tim Graham <timograham@gmail.com> | 2018-10-28 22:54:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-28 22:54:02 -0400 |
| commit | f77fc56c9671a2e2498e3920d79e247e6de18c16 (patch) | |
| tree | c9f0a600a86e8d81bcf09ab6422ec841117877c7 /tests | |
| parent | 5e8a07d69dee354d9e6dbda874f9454f4bc3491e (diff) | |
Fixed #29896 -- Fixed incorrect Model.save() cache relation clearing for foreign keys that use to_field.
Regression in ee49306176a2d2f1751cb890bd607d42c7c09196.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/many_to_one/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/many_to_one/tests.py b/tests/many_to_one/tests.py index a2ff587ab3..b04e6ad77a 100644 --- a/tests/many_to_one/tests.py +++ b/tests/many_to_one/tests.py @@ -666,3 +666,9 @@ class ManyToOneTests(TestCase): self.a.reporter_id = self.r2.pk self.a.save() self.assertEqual(self.a.reporter, self.r2) + + def test_cached_foreign_key_with_to_field_not_cleared_by_save(self): + parent = Parent.objects.create(name='a') + child = ToFieldChild.objects.create(parent=parent) + with self.assertNumQueries(0): + self.assertIs(child.parent, parent) |
