diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-08-11 02:22:42 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-08-11 02:22:42 +0000 |
| commit | 01983c8fc3f96b914b639e2e35b2435c729336eb (patch) | |
| tree | a4df75c629b67e84be70b54e2eb3f97fc4036288 /django | |
| parent | caa51f4444338aaf92409ab45b1cbe885389eb2f (diff) | |
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
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management.py | 8 |
1 files 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]) |
