Skip to content

Commit

Permalink
Handle Apps with South migrations as unmigrated apps.
Browse files Browse the repository at this point in the history
  • Loading branch information
apollo13 committed Oct 15, 2013
1 parent 975415a commit ed8919c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django/db/migrations/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,25 @@ def load_disk(self):
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_"
Expand Down

0 comments on commit ed8919c

Please sign in to comment.