Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make db.migrations ignore South-style migrations.

  • Loading branch information...
commit 32838a5beb29fe4f23fa7881e6535b1b7384d39c 1 parent b80be68
Andrew Godwin authored September 06, 2013

Showing 1 changed file with 10 additions and 1 deletion. Show diff stats Hide diff stats

  1. 11  django/db/migrations/loader.py
11  django/db/migrations/loader.py
@@ -82,9 +82,18 @@ def load_disk(self):
82 82
                         migration_names.add(import_name)
83 83
             # Load them
84 84
             for migration_name in migration_names:
85  
-                migration_module = import_module("%s.%s" % (module_name, migration_name))
  85
+                try:
  86
+                    migration_module = import_module("%s.%s" % (module_name, migration_name))
  87
+                except ImportError as e:
  88
+                    # Ignore South import errors, as we're triggering them
  89
+                    if "south" in str(e).lower():
  90
+                        continue
  91
+                    raise
86 92
                 if not hasattr(migration_module, "Migration"):
87 93
                     raise BadMigrationError("Migration %s in app %s has no Migration class" % (migration_name, app_label))
  94
+                # Ignore South-style migrations
  95
+                if hasattr(migration_module.Migration, "forwards"):
  96
+                    continue
88 97
                 self.disk_migrations[app_label, migration_name] = migration_module.Migration(migration_name, app_label)
89 98
 
90 99
     def get_migration_by_prefix(self, app_label, name_prefix):

0 notes on commit 32838a5

Please sign in to comment.
Something went wrong with that request. Please try again.