Ticket #15076: inspectdb_15194.diff

File inspectdb_15194.diff, 833 bytes (added by saschwarz, 5 years ago)
  • django/core/management/commands/inspectdb.py

     
    7676                    comment_notes.append('Field name made lowercase.')
    7777
    7878                if i in relations:
    79                     rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1])
    80                     field_type = 'ForeignKey(%s' % rel_to
     79                    rel_to = relations[i][1] == table_name and "self" or table2model(relations[i][1])
     80                    field_type = "ForeignKey('%s'" % rel_to
    8181                    if att_name.endswith('_id'):
    8282                        att_name = att_name[:-3]
    8383                    else:
Back to Top