Removing A Django Application Completely with South


Removing A Django Application Completely with South

Let's pretend that the application that you want remove contains the following model in myapp/ class SomeModel(models.Model): data = models.TextField

Create the initial migration and apply it to the database:

    ./ schemamigration --initial myapp
    ./ migrate

To remove the Models edit myapp/ and remove all the model definitions

Create the deleting migration:

    ./ schemamigration myapp

Edit myapp/migrations/ to remove the related content types

    from django.contrib.contenttypes.models import ContentType
    def forwards(self, orm):

        # Deleting model 'SomeModel'
        for content_type in ContentType.objects.filter(app_label='myapp'):

Migrate the App and remove the table, then fake a zero migration to clean out the south tables

    ./ migrate
    ./ migrate myapp zero --fake

Remove the app from your and it should now be fully gone....