我有一个迁移:
...
def forwards(self, orm):
for p in products.models.Product.objects.all():
new = cart.models.Product(title = p.title)
new.save()
def backwards():
...
但是,当我运行迁移时,它会在循环中运行两次。
最佳答案
你有没有
no_dry_run = True
在迁移定义中?
此外,我认为您应该使用
orm.Product.objects.all()
关于django - Django South数据迁移运行两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2340448/