Django, South, and Guardian: Migrate
Asked Answered
A

1

0

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.

Appellant answered 8/8, 2013 at 4:3 Comment(0)
S
1

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

Subdual answered 8/8, 2013 at 4:9 Comment(1)
You can also use django-extensions's update_permissions management command.Brooking

© 2022 - 2024 — McMap. All rights reserved.