Posted By

tekeiro on 08/29/14


Tagged

South


Versions (?)

[South] Create intermediate migration in South


 / Published in: Django
 

How to create an custom migration in South

  1. $ ./manage.py datamigration app name
  2.  
  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)
  9.  
  10. def backwards(self, orm):
  11. orm.Preferences.objects.all().delete()

Report this snippet  

You need to login to post a comment.