Django,South和Guardian:迁移 [英] Django, South, and Guardian: Migrate
问题描述
class Meta:
permissions =(
('read','read'),
('write','write'),
)
从shell中,我设置了权限:
>>> > frhde = create modelA instance
>>>> assign_perm('read',mh00h2,frhde)
DoesNotExist:权限匹配查询不存在。查询参数是{'codename':u'read','content_type':< ContentType:modelA>}
c code code code code code code code $ c > modelA 并确认了这一点。将读取
到 read2
显示 South
没有检测到更改。
$ /manage.py schemamigration myapp --auto
运行myapp迁移:
- 没有任何迁移。
- 加载myapp的初始数据。
从0个夹具中安装0个对象
运行监护人的迁移:
- 没有任何迁移。
- 加载监护人的初始数据。
从0夹具中安装0个对象
如何获取原理图迁移要正确更新数据库,还是有更好的方法来做到这一点,不需要重做整个数据库?
谢谢。
您可以使用 ./ manage.py syncdb --all
,或创建一个信号, a href =http://devwithpassion.com/felipe/south-django-permissions/ =nofollow>这篇文章。
I have two users, mh00h1 and mh00h2. I also have modelA that defines the following in my models.py:
class Meta:
permissions = (
('read','read'),
('write','write'),
)
From a shell, I went to set permissions:
>>>> 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>}
I realized that South
didn't migrate my models after I added class Meta
to modelA
and confirmed this. Changing read
to read2
shows that South
does not detect the change.
$ /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)
How can I get schematicmigration to correctly update the database, or is there a better way to do this that does not require redoing the whole database?
Thank you.
You can use ./manage.py syncdb --all
, or create a signal like in this post.
这篇关于Django,South和Guardian:迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!