mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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:
parent
1c4f5f314e
commit
5d20e02078
3 changed files with 49 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue