Commits

amcc...@69d324d9-c39d-4fdc-8679-7745eae9e2c8  committed 92dc2aa

Added another TODO note about generate_field_definition needing to support model inheritance

  • Participants
  • Parent commits 4fee724

Comments (0)

Files changed (1)

File management/commands/startmigration.py

             field_pieces.append(match.groups()[0])
             if test_field(' '.join(field_pieces)):
                 return ' '.join(field_pieces)
-                
+    
+    # TODO:
+    # If field definition isn't found, try looking in models parents.
+    # This should most likely work with just a recursive call to generate_field_definition
+    # supplying the models parents and the current field
+    
     # the 'id' field never gets defined, so return what django does by default
     # django.db.models.options::_prepare
-    if field.name == 'id' and isinstance(field, models.AutoField):
+    if field.name == 'id' and field.__class__ == models.AutoField:
         return "models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)"
             
     raise Exception("Couldn't find field definition for field: '%s' on model: '%s'" % (