Commits

Andrew Godwin committed a645586

Fixed #653: Dots in ManualChanges migrations. Thanks to Daniel Roseman.

  • Participants
  • Parent commits c92d62e

Comments (0)

Files changed (2)

south/creator/changes.py

             bits.append('add_field_%s' % field_name)
         for index_name in self.added_indexes:
             bits.append('add_index_%s' % index_name)
-        return '_'.join(bits)
+        return '_'.join(bits).replace('.', '_')
     
     def get_changes(self):
         # Get the model defs so we can use them for the yield later
                     yield ("AddM2M", {
                         "model": model,
                         "field": field,
-                    })
+                    })

south/tests/logic.py

 from south import exceptions
 from south.migration import migrate_app
 from south.migration.base import all_migrations, Migration, Migrations
+from south.creator.changes import ManualChanges
 from south.migration.utils import depends, dfs, flatten, get_app_label
 from south.models import MigrationHistory
 from south.tests import Monkeypatcher
             graph,
         )
 
+class TestManualChanges(Monkeypatcher):
+    installed_apps = ["fakeapp", "otherfakeapp"]
+
+    def test_suggest_name(self):
+        migrations = Migrations('fakeapp')
+        change = ManualChanges(migrations,
+                               [],
+                               ['fakeapp.slug'],
+                               [])
+        self.assertEquals(change.suggest_name(), 
+                          'add_field_fakeapp_slug')
+
+        change = ManualChanges(migrations,
+                               [],
+                               [],
+                               ['fakeapp.slug'])
+        self.assertEquals(change.suggest_name(), 
+                          'add_index_fakeapp_slug')