Fixed #33414 -- Fixed creating diamond-shaped MTI objects for common ancestor with primary key that has a default.

Co-authored-by: Simon Charette <charette.s@gmail.com>
This commit is contained in:
Akash Kumar Sen 2023-05-30 20:08:43 +05:30 committed by Mariusz Felisiak
parent 1c4f5f314e
commit 5d20e02078
3 changed files with 49 additions and 11 deletions

View file

@ -186,3 +186,23 @@ class Child(Parent):
class GrandChild(Child):
pass
class CommonAncestor(models.Model):
id = models.IntegerField(primary_key=True, default=1)
class FirstParent(CommonAncestor):
first_ancestor = models.OneToOneField(
CommonAncestor, models.CASCADE, primary_key=True, parent_link=True
)
class SecondParent(CommonAncestor):
second_ancestor = models.OneToOneField(
CommonAncestor, models.CASCADE, primary_key=True, parent_link=True
)
class CommonChild(FirstParent, SecondParent):
pass