Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved the space check from r3549 to before the Python keyword check s…

…o 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
  • Loading branch information...
commit 01983c8fc3f96b914b639e2e35b2435c729336eb 1 parent caa51f4
@malcolmt malcolmt authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/core/management.py
View
8 django/core/management.py
@@ -729,14 +729,14 @@ def table2model(table_name):
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])
Please sign in to comment.
Something went wrong with that request. Please try again.