Skip to content

Instantly share code, notes, and snippets.

@teserak
Forked from mattupstate/convert_all_to_south.py
Created November 30, 2011 00:15
Show Gist options
  • Save teserak/1407296 to your computer and use it in GitHub Desktop.
Save teserak/1407296 to your computer and use it in GitHub Desktop.
Django management command to convert all your apps to use South migrations
import settings
from django.core.management.base import BaseCommand
from subprocess import call
class Command(BaseCommand):
def _is_project_app(self, app_name):
return not 'django' in app_name and not 'south' in app_name
def handle(self, *args, **options):
try:
call(['./manage.py', 'syncdb'])
for app in settings.INSTALLED_APPS:
if self._is_project_app(app):
call(['./manage.py', 'convert_to_south', app])
print 'All applications converted to south'
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment