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

Fixed #34634 -- Adjusted system check for clashing fields to warn about links to common parent for MTI models.

This commit is contained in:
Akash Kumar Sen
2023-06-15 23:13:49 +05:30
committed by Mariusz Felisiak
parent d6e9ec4014
commit 82a588a6bc
2 changed files with 40 additions and 0 deletions

View File

@@ -1070,6 +1070,31 @@ class ShadowingFieldsTests(SimpleTestCase):
],
)
def test_diamond_mti_common_parent(self):
class GrandParent(models.Model):
pass
class Parent(GrandParent):
pass
class Child(Parent):
pass
class MTICommonParentModel(Child, GrandParent):
pass
self.assertEqual(
MTICommonParentModel.check(),
[
Error(
"The field 'grandparent_ptr' clashes with the field "
"'grandparent_ptr' from model 'invalid_models_tests.parent'.",
obj=MTICommonParentModel,
id="models.E006",
)
],
)
def test_id_clash(self):
class Target(models.Model):
pass