Ticket #16536: inspectdb_numeric_fields_16536_2.diff

File inspectdb_numeric_fields_16536_2.diff, 963 bytes (added by danodonovan, 4 years ago)

ammended patch

  • django/core/management/commands/inspectdb.py

     
    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)
     106                    extra_params['db_column'] = unicode(column_name)
     107                    comment_notes.append('Field renamed because it wasn\'t a \
     108                        valid Python identifier')
     109
    104110                # Don't output 'id = meta.AutoField(primary_key=True)', because
    105111                # that's assumed if it doesn't exist.
    106112                if att_name == 'id' and field_type == 'AutoField(' and extra_params == {'primary_key': True}:
Back to Top