----- Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2006-08-10 at 05:55 -0400, John Szakmeister wrote: > > Now that the magic has been removed, and Django released 0.95, I > decided to start porting my applications over. I knew the merge of > magic-removal was coming, so I never deployed the apps. So, I decided > to dump the tables that I had (there was no useful information in > them) and start over. Well, my project had the following in the > settings file: > > INSTALLED_APPS = ( > > 'django.contrib.*', > > 'www.apps.blog', > > 'www.apps.jobs', > > ) > [...] > > The problem is that the tables for django.contrib.sites aren't > created > > before the flatpages tables. I made a simple change to the > settings > > file to include the sites app before the others, so it was an easy > > fix. > > > > The reason I bring it up at all is that if were going to allow a > > wildcard, it seems reasonable to expect that interdependencies are > > going to be worked out, and the tables will be created in the right > > order. Otherwise, the wildcard loses some of it's appeal. Is there > a > > simple way to extract the dependencies on other apps models, before > > the tables are created? If so, I can take a stab at fixing syncdb > to > > Do The Right Thing. > > Have a poke around in django/core/management.py in the > _get_sql_model_create() function and see if you can work out why > we're > getting this wrong. > > The fact that the generated SQL has a "...REFERENCES ..." clause on > the > problem line, rather than trying an "ALTER TABLE..." statement later > (out of _get_sql_for_pending_references()) means that the code thinks > that table has already been created. We try hard not to do that. So I > suspect this is a silly bug somewhere and it might be easy to fix if > you > drop in a few print statements and have an already failing example.
Looks like the problem is in _get_many_to_many_sql_for_model(). Unfortunately, it doesn't check to see whether or not the table exists before generating a reference. Is there somewhere else where the models are ordered by dependency before creation? -John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~----------~----~----~----~------~----~------~--~---