Make db.migrations ignore South-style migrations.
This commit is contained in:
parent
b80be68e08
commit
32838a5beb
|
@ -82,9 +82,18 @@ class MigrationLoader(object):
|
||||||
migration_names.add(import_name)
|
migration_names.add(import_name)
|
||||||
# Load them
|
# Load them
|
||||||
for migration_name in migration_names:
|
for migration_name in migration_names:
|
||||||
|
try:
|
||||||
migration_module = import_module("%s.%s" % (module_name, migration_name))
|
migration_module = import_module("%s.%s" % (module_name, migration_name))
|
||||||
|
except ImportError as e:
|
||||||
|
# Ignore South import errors, as we're triggering them
|
||||||
|
if "south" in str(e).lower():
|
||||||
|
continue
|
||||||
|
raise
|
||||||
if not hasattr(migration_module, "Migration"):
|
if not hasattr(migration_module, "Migration"):
|
||||||
raise BadMigrationError("Migration %s in app %s has no Migration class" % (migration_name, app_label))
|
raise BadMigrationError("Migration %s in app %s has no Migration class" % (migration_name, app_label))
|
||||||
|
# Ignore South-style migrations
|
||||||
|
if hasattr(migration_module.Migration, "forwards"):
|
||||||
|
continue
|
||||||
self.disk_migrations[app_label, migration_name] = migration_module.Migration(migration_name, app_label)
|
self.disk_migrations[app_label, migration_name] = migration_module.Migration(migration_name, app_label)
|
||||||
|
|
||||||
def get_migration_by_prefix(self, app_label, name_prefix):
|
def get_migration_by_prefix(self, app_label, name_prefix):
|
||||||
|
|
Loading…
Reference in New Issue