【发布时间】:2014-10-28 23:41:55
【问题描述】:
所以我需要做的是更改整个数据库中某个字段的值。我不需要实际更改与架构相关的任何内容。像这样的东西。
def forwards(self, orm):
the_things = Thing.objects.filter(widget="some value"):
for thing in the_things:
thing.widget = "some new value"
thing.save()
def backwords(self, orm):
the_things = Thing.objects.filter(widget="some new value"):
for thing in the_things:
thing.widget = "some value"
thing.save()
我是使用南的新手,所以我不确定执行此类操作的最佳方法。仅手动制作迁移文件是不好的做法吗?似乎是因为运行./manage.py schemamigration app --auto 似乎遵循它生成的文件名中的命名约定。
【问题讨论】:
标签: python database django migration django-south