Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #6374: cross-app and circular FK constraints are now detected a…

…nd added correctly. Thanks, dready.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 50bf56767531e1f29e000d039237ad1149d46bad 1 parent a128ce7
Jacob Kaplan-Moss authored March 10, 2008
1  AUTHORS
@@ -112,6 +112,7 @@ answer newbie questions, and generally made Django that much better:
112 112
     Sander Dijkhuis <sander.dijkhuis@gmail.com>
113 113
     Jordan Dimov <s3x3y1@gmail.com>
114 114
     dne@mayonnaise.net
  115
+    dready <wil@mojipage.com>
115 116
     Maximillian Dornseif <md@hudora.de>
116 117
     Jeremy Dunck <http://dunck.us/>
117 118
     Andrew Durdin <adurdin@gmail.com>
2  django/core/management/commands/syncdb.py
@@ -67,6 +67,8 @@ def handle_noargs(self, **options):
67 67
                 created_models.add(model)
68 68
                 for refto, refs in references.items():
69 69
                     pending_references.setdefault(refto, []).extend(refs)
  70
+                    if refto in seen_models:
  71
+                        sql.extend(sql_for_pending_references(refto, self.style, pending_references))
70 72
                 sql.extend(sql_for_pending_references(model, self.style, pending_references))
71 73
                 if verbosity >= 1:
72 74
                     print "Creating table %s" % model._meta.db_table
2  django/core/management/sql.py
@@ -90,6 +90,8 @@ def sql_create(app, style):
90 90
         final_output.extend(output)
91 91
         for refto, refs in references.items():
92 92
             pending_references.setdefault(refto, []).extend(refs)
  93
+            if refto in known_models:
  94
+                final_output.extend(sql_for_pending_references(refto, style, pending_references))
93 95
         final_output.extend(sql_for_pending_references(model, style, pending_references))
94 96
         # Keep track of the fact that we've created the table for this model.
95 97
         known_models.add(model)

0 notes on commit 50bf567

Please sign in to comment.
Something went wrong with that request. Please try again.