mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +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:
committed by
Mariusz Felisiak
parent
1c4f5f314e
commit
5d20e02078
@@ -9,6 +9,7 @@ from django.test.utils import CaptureQueriesContext, isolate_apps
|
||||
from .models import (
|
||||
Base,
|
||||
Chef,
|
||||
CommonChild,
|
||||
CommonInfo,
|
||||
CustomSupplier,
|
||||
GrandChild,
|
||||
@@ -149,6 +150,14 @@ class ModelInheritanceTests(TestCase):
|
||||
# accidentally found).
|
||||
self.assertSequenceEqual(s.titles.all(), [])
|
||||
|
||||
def test_create_diamond_mti_default_pk(self):
|
||||
# 1 INSERT for each base.
|
||||
with self.assertNumQueries(4):
|
||||
common_child = CommonChild.objects.create()
|
||||
# 3 SELECTs for the parents, 1 UPDATE for the child.
|
||||
with self.assertNumQueries(4):
|
||||
common_child.save()
|
||||
|
||||
def test_update_parent_filtering(self):
|
||||
"""
|
||||
Updating a field of a model subclass doesn't issue an UPDATE
|
||||
|
||||
Reference in New Issue
Block a user