Ticket #17676: ticket17676.diff

File ticket17676.diff, 829 bytes (added by Gandalfar, 4 years ago)
  • django/core/management/commands/inspectdb.py

    diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
    index e81f399..8da0d7e 100644
    a b class Command(NoArgsCommand): 
    101101                    att_name += '_field'
    102102                    comment_notes.append('Field renamed because it was a Python reserved word.')
    103103
    104                 if att_name.isdigit():
    105                     att_name = 'number_%d' % int(att_name)
     104                if att_name[0].isdigit():
     105                    att_name = 'number_%s' % att_name
    106106                    extra_params['db_column'] = unicode(column_name)
    107107                    comment_notes.append("Field renamed because it wasn't a "
    108108                        "valid Python identifier.")
Back to Top