Django,南方和卫报:迁移

时间:2013-08-08 04:03:36

标签: python django django-south django-guardian

我有两个用户,mh00h1和mh00h2。我还有modelA,它在我的models.py中定义了以下内容:

class Meta:
    permissions = (
        ('read','read'),
        ('write','write'),
    )

从shell开始,我去设置权限:

>>>> frhde = create modelA instance
>>>> assign_perm('read', mh00h2, frhde)

DoesNotExist: Permission matching query does not exist. Lookup parameters were {'codename': u'read', 'content_type': <ContentType: modelA>}

我意识到Southclass Meta添加到modelA并且确认了这一点后,我没有迁移我的模型。将read更改为read2表示South未检测到更改。

$ /manage.py schemamigration myapp --auto

Running migrations for myapp:
- Nothing to migrate.
 - Loading initial data for myapp.
Installed 0 object(s) from 0 fixture(s)
Running migrations for guardian:
- Nothing to migrate.
 - Loading initial data for guardian.
Installed 0 object(s) from 0 fixture(s)

如何让原型移植正确更新数据库,或者有更好的方法来执行此操作而不需要重做整个数据库?

谢谢。

1 个答案:

答案 0 :(得分:1)

您可以使用./manage.py syncdb --all,或创建this post中的信号。