summaryrefslogtreecommitdiff
path: root/django/core/management/commands/inspectdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/management/commands/inspectdb.py')
-rw-r--r--django/core/management/commands/inspectdb.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index f30a00b7b2..54203c532b 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -15,8 +15,9 @@ class Command(NoArgsCommand):
def handle_inspection(self):
from django.db import connection
import keyword
-
- table2model = lambda table_name: table_name.title().replace('_', '').replace(' ', '').replace('-', '')
+
+ table2model = lambda table_name: table_name.title()
+ .replace('_', '').replace(' ', '').replace('-', '').replace('*','_').replace(',','_')
cursor = connection.cursor()
yield "# This is an auto-generated Django model module."
@@ -73,7 +74,7 @@ class Command(NoArgsCommand):
extra_params['db_column'] = column_name
else:
try:
- field_type = connection.introspection.data_types_reverse[row[1]]
+ field_type = connection.introspection.get_field_type(row[1], row)
except KeyError:
field_type = 'TextField'
comment_notes.append('This field type is a guess.')