diff options
| author | Chris Beaven <smileychris@gmail.com> | 2014-03-11 12:23:45 +1300 |
|---|---|---|
| committer | Chris Beaven <smileychris@gmail.com> | 2014-03-11 12:23:45 +1300 |
| commit | 40f6ca54f848f783f65855fcc7188a276de3974b (patch) | |
| tree | 44dedacb0f66e558c5e86b9ee2db582f931ba663 | |
| parent | 05daaf2eea1bbff8da6f5367b9f7f05f8b1ab67e (diff) | |
Fix autodetector creation of RenameModel migration to capitalize model names
| -rw-r--r-- | django/db/migrations/autodetector.py | 4 | ||||
| -rw-r--r-- | tests/migrations/test_autodetector.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index a9f6b610de..cbc4604159 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -93,8 +93,8 @@ class MigrationAutodetector(object): 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 diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py index eefee6fa76..c3ada832f4 100644 --- a/tests/migrations/test_autodetector.py +++ b/tests/migrations/test_autodetector.py @@ -203,8 +203,8 @@ class AutodetectorTests(TestCase): # 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 @@ class AutodetectorTests(TestCase): # 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) |
