1. Lucian Ursu
  2. south

Commits

and...@69d324d9-c39d-4fdc-8679-7745eae9e2c8  committed 22ac2e2

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

  • Participants
  • Parent commits 476f12a
  • Branches default

Comments (0)

Files changed (1)

File management/commands/startmigration.py

View file
  • Ignore whitespace
         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: