2014-03-26 38 views
7

使用别人的代码叉子,我增加了一个模式场,做一般的自动迁移:如何冻结解冻模型,以便继续使用南?

~ $ django_admin.py migrate mezzanine_slides --auto 
You cannot use automatic detection, since the previous migration does not have this whole app frozen. 
Either make migrations using '--freeze mezzanine_slides' or set 'SOUTH_AUTO_FREEZE_APP = True' in your settings.py. 

我使用的提示无果尝试了明显的选项,并从文档毫无进展。

回答

8

OK,有一些试验和错误:我创建了一个“冻结流动”这样的:

~ $ django_admin.py schemamigration --freeze mezzanine_slides mezzanine_slides freeze --empty 
Created 0002_freeze.py. You must now edit this migration and add the code for each direction. 

然后我编辑所产生的迁移和删除了我额外的字段,以便:与

! $ django_admin.py schemamigration mezzanine_slides --auto 
+ Added field caption on mezzanine_slides.Slide 
Created 0003_auto__add_field_slide_caption.py. You can now apply this migration with: ./manage.py migrate mezzanine_slides 

这样做,迁移工作正常。