Skip to content

Instantly share code, notes, and snippets.

@gregnewman
Created November 7, 2012 23:55
Show Gist options
  • Select an option

  • Save gregnewman/4035476 to your computer and use it in GitHub Desktop.

Select an option

Save gregnewman/4035476 to your computer and use it in GitHub Desktop.

Revisions

  1. Greg Newman created this gist Nov 7, 2012.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    from django.contrib.contenttypes.models import ContentType

    def run():

    def do(Table):
    if Table is not None:
    table_objects = Table.objects.all()
    for i in table_objects:
    i.save(using='slave')

    ContentType.objects.using('slave').all().delete()

    for i in ContentType.objects.all():
    do(i.model_class())