Skip to content

Instantly share code, notes, and snippets.

@phretor
Created December 20, 2010 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phretor/748246 to your computer and use it in GitHub Desktop.
Save phretor/748246 to your computer and use it in GitHub Desktop.
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Publication.subclass'
db.add_column('publishing_publication', 'subclass', self.gf('django.db.models.fields.CharField')(default='Publication', max_length=48), keep_default=False)
for obj in orm.Publication.objects.all():
obj.subclass = '{0}.{1}'.format(
obj._meta.app_label, obj.__class__.__name__)
obj.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment