django - How do I create objects during a data migration? -
i'm trying create new object during data migration. far can tell should use orm.object()
create new object, doesn't seem working:
def forwards(self, orm): o in orm['app.objects'].objects.all(): ... n = orm.newobject() n.date = datetime.date.today() n.object = o n.save()
i error
attributeerror: 'nonetype' object has no attribute 'date'
when run migration, suggesting n
not being created properly. doing wrong?
i create these as:
def forwards(self, orm): obj in orm['my_app.modelname'].objects.all(): orm.someothermodel.objects.create(some_property=obj.some_property)
Comments
Post a Comment