迁移后数据库不会更改

时间:2012-07-27 01:24:13

标签: django django-south

所以使用南方,我想在我的一个模型中添加一个新字段is_private。

在本教程之后,在更改models.py文件之后,我应该这样做:

./manage.py schemamigration reconstructions --auto

返回:

 Added field is_private on reconstructions.Reconstruction
Created 0005_auto__add_field_reconstruction_is_private.py. You can now apply this migration with: ./manage.py migrate reconstructions

哪个好。现在下一步是,

python manage.py migrate reconstructions

打印出来:

- Migrating forwards to 0005_auto__add_field_reconstruction_is_private.
 > reconstructions:0005_auto__add_field_reconstruction_is_private
 - Loading initial data for reconstructions.
No fixtures found.
它似乎正在做它的工作。但是当我事后检查字段is_private时,Django会抛出一个错误:

Cannot resolve keyword 'is_private' into field.

这告诉我南方根本没有改变数据库。为什么会这样?

额外信息: 模型类:

class Reconstruction(models.Model):
    id = models.CharField(max_length=36, primary_key=True,
                          editable=False)

    uploader = models.ForeignKey(User, blank=True, null=True)
    status = models.TextField(blank=True)
    viewcount = models.IntegerField(default=0)
    error_flag = models.IntegerField(default=0)
    is_done = models.BooleanField(default=False)
    create_date = models.DateTimeField(auto_now=True)
    last_modified_date = models.DateTimeField(auto_now=True)
    is_private = models.BooleanField(default=True)

导致崩溃的代码:

recordings = Recording.objects.filter(is_done=True).filter(is_private=False).order_by('-create_date')

0 个答案:

没有答案
相关问题