diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-08-10 16:58:26 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-08-10 16:58:26 +0000 |
| commit | caa51f4444338aaf92409ab45b1cbe885389eb2f (patch) | |
| tree | 0842034d69cac11a6361b0d6d952ce77c1eac85a | |
| parent | a6a402a7db45ea7d2bb8521b989de573c4f72fee (diff) | |
Fixed #2517 -- Improved inspectdb to handle table column names that contain spaces. Thanks, Karen Tracey
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/core/management.py | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -131,6 +131,7 @@ answer newbie questions, and generally made Django that much better: Tom Tobin Tom Insam Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> + Karen Tracey <graybark@bellsouth.net> Amit Upadhyay Geert Vanderkelen Milton Waddams diff --git a/django/core/management.py b/django/core/management.py index 6a077f1d1a..f1e240b88c 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -733,6 +733,10 @@ def inspectdb(): 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]) |
