Fix autodetector creation of RenameModel migration to capitalize model names
This commit is contained in:
parent
05daaf2eea
commit
40f6ca54f8
|
@ -93,8 +93,8 @@ class MigrationAutodetector(object):
|
||||||
self.add_to_migration(
|
self.add_to_migration(
|
||||||
app_label,
|
app_label,
|
||||||
operations.RenameModel(
|
operations.RenameModel(
|
||||||
old_name=rem_model_name,
|
old_name=rem_model_state.name,
|
||||||
new_name=model_name,
|
new_name=model_state.name,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
renamed_models[app_label, model_name] = rem_model_name
|
renamed_models[app_label, model_name] = rem_model_name
|
||||||
|
|
|
@ -203,8 +203,8 @@ class AutodetectorTests(TestCase):
|
||||||
# Right action?
|
# Right action?
|
||||||
action = migration.operations[0]
|
action = migration.operations[0]
|
||||||
self.assertEqual(action.__class__.__name__, "RenameModel")
|
self.assertEqual(action.__class__.__name__, "RenameModel")
|
||||||
self.assertEqual(action.old_name, "author")
|
self.assertEqual(action.old_name, "Author")
|
||||||
self.assertEqual(action.new_name, "writer")
|
self.assertEqual(action.new_name, "Writer")
|
||||||
|
|
||||||
# Right number of migrations for related field rename?
|
# Right number of migrations for related field rename?
|
||||||
self.assertEqual(len(changes['otherapp']), 1)
|
self.assertEqual(len(changes['otherapp']), 1)
|
||||||
|
@ -236,8 +236,8 @@ class AutodetectorTests(TestCase):
|
||||||
# Right actions?
|
# Right actions?
|
||||||
action = migration.operations[0]
|
action = migration.operations[0]
|
||||||
self.assertEqual(action.__class__.__name__, "RenameModel")
|
self.assertEqual(action.__class__.__name__, "RenameModel")
|
||||||
self.assertEqual(action.old_name, "author")
|
self.assertEqual(action.old_name, "Author")
|
||||||
self.assertEqual(action.new_name, "writer")
|
self.assertEqual(action.new_name, "Writer")
|
||||||
|
|
||||||
# Right number of migrations for related field rename?
|
# Right number of migrations for related field rename?
|
||||||
self.assertEqual(len(changes['otherapp']), 1)
|
self.assertEqual(len(changes['otherapp']), 1)
|
||||||
|
|
Loading…
Reference in New Issue