Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix autodetector creation of RenameModel migration to capitalize mode…

…l names
  • Loading branch information...
commit 40f6ca54f848f783f65855fcc7188a276de3974b 1 parent 05daaf2
@SmileyChris SmileyChris authored
View
4 django/db/migrations/autodetector.py
@@ -93,8 +93,8 @@ def _rel_agnostic_fields_def(fields):
self.add_to_migration(
app_label,
operations.RenameModel(
- old_name=rem_model_name,
- new_name=model_name,
+ old_name=rem_model_state.name,
+ new_name=model_state.name,
)
)
renamed_models[app_label, model_name] = rem_model_name
View
8 tests/migrations/test_autodetector.py
@@ -203,8 +203,8 @@ def test_rename_model(self):
# Right action?
action = migration.operations[0]
self.assertEqual(action.__class__.__name__, "RenameModel")
- self.assertEqual(action.old_name, "author")
- self.assertEqual(action.new_name, "writer")
+ self.assertEqual(action.old_name, "Author")
+ self.assertEqual(action.new_name, "Writer")
# Right number of migrations for related field rename?
self.assertEqual(len(changes['otherapp']), 1)
@@ -236,8 +236,8 @@ def test_rename_model_with_renamed_rel_field(self):
# Right actions?
action = migration.operations[0]
self.assertEqual(action.__class__.__name__, "RenameModel")
- self.assertEqual(action.old_name, "author")
- self.assertEqual(action.new_name, "writer")
+ self.assertEqual(action.old_name, "Author")
+ self.assertEqual(action.new_name, "Writer")
# Right number of migrations for related field rename?
self.assertEqual(len(changes['otherapp']), 1)
Please sign in to comment.
Something went wrong with that request. Please try again.