I have a migration:
...
def forwards(self, orm):
for p in products.models.Product.objects.all():
new = cart.models.Product(title = p.title)
new.save()
def backwards():
...
But when I run migrate it runs through the loop twice.
do you have
no_dry_run = True
in the migration definition?
besides, I think you should be using orm.Product.objects.all()
This happens because South run twice: first time it not touch DB, second time push changes to db.
Fast solution run ./manage migrate your_app --db-dry-run
Or use
if not db.dry_run:
in your code in forward/backward sections
discussed here http://south.aeracode.org/ticket/138
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With