mirror of
https://github.com/django/django.git
synced 2025-12-15 21:45:20 +00:00
Fixed #31954 -- Fixed migration optimization for MTI model creation with parent model with mixed case app label.
This commit is contained in:
parent
225261b701
commit
4c0b4720b0
2 changed files with 22 additions and 1 deletions
|
|
@ -2322,6 +2322,26 @@ class AutodetectorTests(TestCase):
|
|||
self.assertOperationAttributes(changes, 'testapp', 0, 0, name="Author")
|
||||
self.assertOperationAttributes(changes, 'testapp', 0, 1, name="Aardvark")
|
||||
|
||||
def test_bases_first_mixed_case_app_label(self):
|
||||
app_label = 'MiXedCaseApp'
|
||||
changes = self.get_changes([], [
|
||||
ModelState(app_label, 'owner', [
|
||||
('id', models.AutoField(primary_key=True)),
|
||||
]),
|
||||
ModelState(app_label, 'place', [
|
||||
('id', models.AutoField(primary_key=True)),
|
||||
('owner', models.ForeignKey('MiXedCaseApp.owner', models.CASCADE)),
|
||||
]),
|
||||
ModelState(app_label, 'restaurant', [], bases=('MiXedCaseApp.place',)),
|
||||
])
|
||||
self.assertNumberMigrations(changes, app_label, 1)
|
||||
self.assertOperationTypes(changes, app_label, 0, [
|
||||
'CreateModel', 'CreateModel', 'CreateModel',
|
||||
])
|
||||
self.assertOperationAttributes(changes, app_label, 0, 0, name='owner')
|
||||
self.assertOperationAttributes(changes, app_label, 0, 1, name='place')
|
||||
self.assertOperationAttributes(changes, app_label, 0, 2, name='restaurant')
|
||||
|
||||
def test_multiple_bases(self):
|
||||
"""#23956 - Inheriting models doesn't move *_ptr fields into AddField operations."""
|
||||
A = ModelState("app", "A", [("a_id", models.AutoField(primary_key=True))])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue