March 2011 Archives

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....

About this Archive

This page is an archive of entries from March 2011 listed from newest to oldest.

November 2010 is the previous archive.

October 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.