foreign key constraint not set in database for FKs to another application's models
|Reported by:||Owned by:||Philippe Raoult|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Keywords:||foreign key backend|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I am very new to django, I am creating a model with a field of models.ForeignKey(User) #django.contrib.auth.models import User. When I look at the database my table has no foreign key define. Another example is the django.contrib.admin.models.LogEntry model it has user = models.ForeignKey(User) which is also from django.contrib.auth.models.user.
When the relationship is within the same namespace (am I using the right term, pls correct me) the manage.py syncdb create the tables without a problem if all the tables are create on the same time, but if the tables weren't created the same time it also fail to create the foreign keys.
Is this a bug of django or a shortcomings of database driver?
Change History (9)
comment:6 Changed 10 years ago by
|Status:||closed → reopened|
|Summary:||foreign key on database not created with models referencing from other application → foreign key constraint not set in database for FKs to another application's models|
|Triage Stage:||Unreviewed → Design decision needed|
|Version:||0.96 → SVN|
comment:7 Changed 10 years ago by
|Owner:||changed from Adrian Holovaty to Philippe Raoult|
|Status:||reopened → new|