1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #33618 -- Fixed MTI updates outside of primary key chain.

This commit is contained in:
Simon Charette
2022-04-05 22:03:20 -04:00
committed by Mariusz Felisiak
parent 9ffd4eae2c
commit 0b31e02487
3 changed files with 34 additions and 3 deletions

View File

@@ -667,3 +667,15 @@ class ModelInheritanceTest(TestCase):
Politician.objects.get(pk=c1.politician_ptr_id).title,
"senator 1",
)
def test_mti_update_parent_through_child(self):
Politician.objects.create()
Congressman.objects.create()
Congressman.objects.update(title="senator 1")
self.assertEqual(Congressman.objects.get().title, "senator 1")
def test_mti_update_grand_parent_through_child(self):
Politician.objects.create()
Senator.objects.create()
Senator.objects.update(title="senator 1")
self.assertEqual(Senator.objects.get().title, "senator 1")