1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #6374: cross-app and circular FK constraints are now detected and added correctly. Thanks, dready.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2008-03-10 22:18:50 +00:00
parent a128ce785f
commit 50bf567675
3 changed files with 5 additions and 0 deletions

View File

@@ -67,6 +67,8 @@ class Command(NoArgsCommand):
created_models.add(model)
for refto, refs in references.items():
pending_references.setdefault(refto, []).extend(refs)
if refto in seen_models:
sql.extend(sql_for_pending_references(refto, self.style, pending_references))
sql.extend(sql_for_pending_references(model, self.style, pending_references))
if verbosity >= 1:
print "Creating table %s" % model._meta.db_table

View File

@@ -90,6 +90,8 @@ def sql_create(app, style):
final_output.extend(output)
for refto, refs in references.items():
pending_references.setdefault(refto, []).extend(refs)
if refto in known_models:
final_output.extend(sql_for_pending_references(refto, style, pending_references))
final_output.extend(sql_for_pending_references(model, style, pending_references))
# Keep track of the fact that we've created the table for this model.
known_models.add(model)