コード例 #1
0
ファイル: logic.py プロジェクト: hsmett/medianav
 def test_get_app_name(self):
     self.assertEqual(
         "southtest",
         migration.get_app_name(self.create_fake_app("southtest.migrations")),
     )
     self.assertEqual(
         "baz",
         migration.get_app_name(self.create_fake_app("foo.bar.baz.migrations")),
     )
コード例 #2
0
def list_migrations(apps):
    from south.models import MigrationHistory
    apps = list(apps)
    names = [migration.get_app_name(app) for app in apps]
    applied_migrations = MigrationHistory.objects.filter(app_name__in=names)
    applied_migrations = ['%s.%s' % (mi.app_name,mi.migration) for mi in applied_migrations]

    print
    for app in apps:
        print migration.get_app_name(app)
        all_migrations = migration.get_migration_names(app)
        for migration_name in all_migrations:
            long_form = '%s.%s' % (migration.get_app_name(app),migration_name)
            if long_form in applied_migrations:
                print format_migration_list_item(migration_name)
            else:
                print format_migration_list_item(migration_name, applied=False)
        print