glenc
unread,May 16, 2011, 5:11:00 PM5/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to South Users
I'm not 100% sure I'm doing this right, but I think I've found an
issue where auth.Permission objects aren't being created soon enough
for migrations to use them when you initialize a DB from scratch.
The important details:
- I'm trying to initialize a Django DB from scratch using `./manage.py
syncdb --migrate --noinput`
- I have 11 migrations in my chain
- The 1st migration creates a new model called `myapp.CompanyAccount`
- The 9th migration tries to fetch the permission
`myapp.change_companyaccount` with:
`p = orm[ "auth.Permission" ].objects.get( codename =
"change_companyaccount" )`
At that point, an exception is raised:
`django.contrib.auth.models.DoesNotExist: Permission matching query
does not exist`
I had assumed that the built-in permissions that are created for every
object would have been created by the time the 1st migration finished,
but it doesn't appear that they are. If I re-run the migration after
the exception, it works the second time because apparently the
permission now exists and the 9th migration can execute without error.
Is there anything that can be done to "flush" everything sometime
before the 9th migration runs so that the whole thing can run in a
single pass without bailing out?
Thanks for any help / advice.