Skip to content

Commit

Permalink
Fixed #2517 -- Improved inspectdb to handle table column names that c…
Browse files Browse the repository at this point in the history
…ontain spaces. Thanks, Karen Tracey

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Aug 10, 2006
1 parent a6a402a commit caa51f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions django/core/management.py
Expand Up @@ -733,6 +733,10 @@ def table2model(table_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])
Expand Down

0 comments on commit caa51f4

Please sign in to comment.