mirror of
https://github.com/django/django.git
synced 2025-08-31 07:47:37 +00:00
Fixed #29896 -- Fixed incorrect Model.save() cache relation clearing for foreign keys that use to_field.
Regression in ee49306176
.
This commit is contained in:
parent
5e8a07d69d
commit
f77fc56c96
3 changed files with 12 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue