Ticket #5643: patch-inspectdb-columncase.diff

File patch-inspectdb-columncase.diff, 1.3 KB (added by Gregor_Kopka, 17 years ago)
  • django/core/management/commands/inspectdb.py

     
    4848                extra_params = {}  # Holds Field parameters such as 'db_column'.
    4949
    5050                if ' ' in att_name:
    51                     extra_params['db_column'] = att_name
     51                    extra_params['db_column'] = row[0]
    5252                    att_name = att_name.replace(' ', '')
    5353                    comment_notes.append('Field renamed to remove spaces.')
    5454                if keyword.iskeyword(att_name):
    55                     extra_params['db_column'] = att_name
     55                    extra_params['db_column'] = row[0]
    5656                    att_name += '_field'
    5757                    comment_notes.append('Field renamed because it was a Python reserved word.')
     58                if att_name != row[0] and (not extra_params.has_key('db_column')):
     59                    extra_params['db_column'] = row[0]
     60                    comment_notes.append('Field renamed because of uppercase characters.')
    5861
    5962                if i in relations:
    6063                    rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1])
Back to Top