0
0
mirror of https://github.com/django/django.git synced 2024-11-30 07:06:18 +01:00

Handle Apps with South migrations as unmigrated apps.

This commit is contained in:
Florian Apolloner 2013-10-15 11:57:30 +02:00
parent 975415a8ce
commit ed8919cbcb

View File

@ -81,20 +81,25 @@ class MigrationLoader(object):
if import_name[0] not in "_.~":
migration_names.add(import_name)
# Load them
south_style_migrations = False
for migration_name in migration_names:
try:
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
south_style_migrations = True
break
raise
if not hasattr(migration_module, "Migration"):
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
south_style_migrations = True
break
self.disk_migrations[app_label, migration_name] = migration_module.Migration(migration_name, app_label)
if south_style_migrations:
self.unmigrated_apps.add(app_label)
def get_migration_by_prefix(self, app_label, name_prefix):
"Returns the migration(s) which match the given app label and name _prefix_"