Ticket #14796: move_keyword_check.diff
File move_keyword_check.diff, 1.4 KB (added by , 14 years ago) |
---|
-
django/core/management/commands/inspectdb.py
66 66 if ' ' in att_name: 67 67 att_name = att_name.replace(' ', '_') 68 68 comment_notes.append('Field renamed to remove spaces.') 69 69 70 if '-' in att_name: 70 71 att_name = att_name.replace('-', '_') 71 72 comment_notes.append('Field renamed to remove dashes.') 72 if keyword.iskeyword(att_name): 73 att_name += '_field' 74 comment_notes.append('Field renamed because it was a Python reserved word.') 73 75 74 if column_name != att_name: 76 75 comment_notes.append('Field name made lowercase.') 77 76 … … 97 96 extra_params['unique'] = True 98 97 99 98 field_type += '(' 99 100 if keyword.iskeyword(att_name): 101 att_name += '_field' 102 comment_notes.append('Field renamed because it was a Python reserved word.') 100 103 101 104 # Don't output 'id = meta.AutoField(primary_key=True)', because 102 105 # that's assumed if it doesn't exist.