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
-~----------~----~----~----~------~----~------~--~---

Reply via email to