Commits

Anonymous committed 8cd2166

[svn r109] Fix for [108], where ForeignKeys weren't being --add-field'd correctly.

  • Participants
  • Parent commits 1be9f89
  • Branches trunk

Comments (0)

Files changed (1)

management/commands/startmigration.py

         if fields_to_add:
             # First, do the added fields
             for model, field_name, field in fields_to_add:
+                field_definition = generate_field_definition(model, field)
+                
                 if field.rel: # ForeignKey, etc.
                     mock_model = create_mock_model(field.rel.to, "        ")
                     field_definition = related_field_definition(field, field_definition)
                 else:
                     mock_model = None
-                    field_definition = generate_field_definition(model, field)
                 
                 # If we can't get it (inspect madness?) then insert placeholder
                 if not field_definition: