From 01983c8fc3f96b914b639e2e35b2435c729336eb Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 11 Aug 2006 02:22:42 +0000 Subject: [PATCH] Moved the space check from r3549 to before the Python keyword check so that perverse column names like "fin ally" don't fall through the cracks. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3550 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/core/management.py b/django/core/management.py index f1e240b88c..877895eb21 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -729,14 +729,14 @@ def inspectdb(): comment_notes = [] # Holds Field notes, to be displayed in a Python comment. extra_params = {} # Holds Field parameters such as 'db_column'. + if ' ' in att_name: + extra_params['db_column'] = att_name + att_name = att_name.replace(' ', '') + comment_notes.append('Field renamed to remove spaces.') if keyword.iskeyword(att_name): extra_params['db_column'] = att_name att_name += '_field' comment_notes.append('Field renamed because it was a Python reserved word.') - elif ' ' in att_name: - extra_params['db_column'] = att_name - att_name = att_name.replace(' ', '') - comment_notes.append('Field renamed to remove spaces.') if relations.has_key(i): rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1])