On 1/24/07, yary <[EMAIL PROTECTED]> wrote: > Two things- going back to my original issue, the post_syncdb signal > wasn't working because the custom permissions (in the Meta nested > class) weren't yet created. I also noticed the SQL hadn't been > executed, which wasn't an issue for me, but was easier to illustrate.
For any given app, the post_syncdb signals should be processed before the initial SQL is installed. However, it does this one app at a time, so if one app depends on permissions from another app (that has not been processed), you will have a problem. Depending on specifics, you might be able to work around the problem in this case by playing with the order in which you declare your apps in 'INSTALLED_APPS' - INSTALLED_APPS is an ordered list, and I _think_ the order in which the models are processed is driven by the declaration order. I could be wrong on this one, though. > The other thing, if I understand patch #2333, the syncdb order will be: > 1. add any new models > 2. For each model in the app (including old models): > 3. if the model is new, install initial fixture > 4. Invoke the post_syncdb signal > 4.1 contrib.auth listens to post_syncdb to create custom > permissions (my guess as to how it's done now, won't change?) > 5. if the model is new, install the initial data/SQL for the app > 6. Install the SQL indicies for the model Almost: 1. Add any new models 2. For each model in the app (including old models): 2.1. Invoke the post_syncdb signal 2.1.X contrib.auth listens to post_syncdb to create custom permissions (my guess as to how it's done now, won't change?) 2.2. if the model is new, install the custom SQL for the app 3. Install the SQL indicies for each new model 4. Install initial fixtures (for all models) You are correct in that 2.1.X won't change - contrib.auth registers a listener on the post_syncdb signal, which installs permissions into the database. (The code is in django.contrib.auth.management.py if you are interested). Step 2.2 (custom sql) will remain SQL statements; post_syncdb will remain python code; fixtures are in fixture format (JSON/XML). In this ordering, your fixture data will be able to reference any permission entry, as all permissions are guaranteed to exist before the initial data is installed. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---