Code

Ticket #1928: bug1928.diff

File bug1928.diff, 778 bytes (added by Geert Vanderkelen, 8 years ago)

Based on Shaun's solution mentioned in the forum thread.

Line 
1Index: management.py
2===================================================================
3--- management.py       (revision 3116)
4+++ management.py       (working copy)
5@@ -106,7 +106,11 @@
6     for klass in app_models:
7         output, references = _get_sql_model_create(klass, models_output)
8         final_output.extend(output)
9-        pending_references.update(references)
10+        for refto, refs in references.iteritems():
11+            try:
12+                pending_references[refto].extend(refs)
13+            except KeyError:
14+                pending_references.update(references)
15         final_output.extend(_get_sql_for_pending_references(klass, pending_references))
16         # Keep track of the fact that we've created the table for this model.
17         models_output.add(klass)