Hi russ, nice to hear from you again...
As of now I am only saying that no foreign key is created by just checking the database tables itself, I haven't perform any django query. doing the describe main_profile and main_cellusage I got the same results ... but for me the MUL value on Key column doesn't represent a foreign key. here's the dll description from mysql manager lite CREATE TABLE `main_profile` ( `id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL, `department` varchar(20) NOT NULL, `level` varchar(3) NOT NULL, PRIMARY KEY (`id`), KEY `main_profile_user_id` (`user_id`), CONSTRAINT `user_id_refs_id_4af9714f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `main_cellusage` ( `id` int(11) NOT NULL auto_increment, `profile_id` int(11) NOT NULL, `minutes` smallint(5) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `main_cellusage_profile_id` (`profile_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; the profile table's dell has constraint clause in it, while the cellusage table has no constraint clause only key clause is only tells that it is index. Thanks james On Jul 22, 11:37 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/22/07, james_027 <[EMAIL PROTECTED]> wrote: > > > > > 5. then i run python manage.py syncdb > > > the result is ... in my cellusage table there is no foreign key > > created. but in the profile table there is a foreign created. > > mysql> describe mytest_profile; > +------------+-------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +------------+-------------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | user_id | int(11) | NO | MUL | | | > | department | varchar(20) | NO | | | | > | level | varchar(3) | NO | | | | > +------------+-------------+------+-----+---------+----------------+ > 4 rows in set (0.15 sec) > > mysql> describe mytest_cellusage; > +------------+----------------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +------------+----------------------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | profile_id | int(11) | NO | MUL | | | > | minutes | smallint(5) unsigned | NO | | | | > +------------+----------------------+------+-----+---------+----------------+ > 3 rows in set (0.00 sec) > > Looks like two foreign keys to me. > > > 6. I delete all the tables again. I re order the items in the > > INSTALLED_APPS settings. from my step no. 3 instead of putting > > ksk.main in the last I put it in the first, then run manage.py syncdb > > > the result is no foreign key on cellusage table and in the profile > > table also ... > > mysql> describe mytest_profile; > +------------+-------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +------------+-------------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | user_id | int(11) | NO | MUL | | | > | department | varchar(20) | NO | | | | > | level | varchar(3) | NO | | | | > +------------+-------------+------+-----+---------+----------------+ > 4 rows in set (0.00 sec) > > mysql> describe mytest_cellusage; > +------------+----------------------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +------------+----------------------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | profile_id | int(11) | NO | MUL | | | > | minutes | smallint(5) unsigned | NO | | | | > +------------+----------------------+------+-----+---------+----------------+ > 3 rows in set (0.00 sec) > > Again - two foreign keys, same tables as before. > > > Please help me, I am really desperate to know where did I go wrong. > > Why is it a foreign key can't be created with a simple relationship. > > Why is it that the order of application in the INSTALLED_APPS has > > effect when performing manage.py syncdb? > > I've asked before, and I'll ask again - how are you coming to the > conclusion that the foreign key isn't getting created? I don't use > MySQL, so I have no experience with the GUI tools. I can only guess > that the key _is_ getting created, but your GUI tool isn't displaying > it in the way you are expecting. > > Can you provide _any_ evidence (other than "I say so") to validate > your claim that the key isn't getting created? A printout of a > database description? A Django query that fails because it can't > access the column? > > 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 -~----------~----~----~----~------~----~------~--~---