Django, South, and Guardian: Migrate

删除回忆录丶 提交于 2019-12-12 05:18:23

问题


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.


回答1:


You can use ./manage.py syncdb --all, or create a signal like in this post.



来源:https://stackoverflow.com/questions/18117687/django-south-and-guardian-migrate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!