문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top