[South] Create intermediate migration in South

/ Published in: Django
Save to your folder(s)

How to create an custom migration in South

Copy this code and paste it in your HTML
  1. $ ./manage.py datamigration app name
  3. #In new migration
  4. #Example: app actual prefences.
  5. class Migration(DataMigration):
  6. def forwards(self, orm):
  7. for user in orm['profiles.User'].objects.all():
  8. orm.Preferences.objects.create(user=user)
  10. def backwards(self, orm):
  11. orm.Preferences.objects.all().delete()

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.