diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index 5f0e278..e6d142b 100644
a
|
b
|
class Command(NoArgsCommand):
|
151 | 151 | field_params['max_length'] = row[3] |
152 | 152 | |
153 | 153 | if field_type == 'DecimalField': |
154 | | field_params['max_digits'] = row[4] |
155 | | field_params['decimal_places'] = row[5] |
| 154 | if not row[4] or not row[5]: |
| 155 | field_notes.append('''max_digits and decimal_places have been guessed, as this database handles decimal fields as float''') |
| 156 | max_digits, decimal_places = 10, 5 |
| 157 | else: |
| 158 | max_digits, decimal_places = row[4], row[5] |
| 159 | field_params['max_digits'] = max_digits |
| 160 | field_params['decimal_places'] = decimal_places |
156 | 161 | |
157 | 162 | return field_type, field_params, field_notes |
158 | 163 | |
diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py
index 5ee7b64..d34a06b 100644
a
|
b
|
class FlexibleFieldLookupDict(object):
|
20 | 20 | 'integer unsigned': 'PositiveIntegerField', |
21 | 21 | 'decimal': 'DecimalField', |
22 | 22 | 'real': 'FloatField', |
| 23 | 'numeric': 'FloatField', |
23 | 24 | 'text': 'TextField', |
24 | 25 | 'char': 'CharField', |
25 | 26 | 'date': 'DateField', |
diff --git a/tests/regressiontests/inspectdb/models.py b/tests/regressiontests/inspectdb/models.py
index fc2548b..0111cc5 100644
a
|
b
|
class People(models.Model):
|
6 | 6 | |
7 | 7 | class Message(models.Model): |
8 | 8 | from_field = models.ForeignKey(People, db_column='from_id') |
| 9 | |
| 10 | class DecimalTest(models.Model): |
| 11 | dec_field = models.DecimalField(max_digits=10, decimal_places=5) |
diff --git a/tests/regressiontests/inspectdb/tests.py b/tests/regressiontests/inspectdb/tests.py
index 683e6e9..5b5cf39 100644
a
|
b
|
class InspectDBTestCase(TestCase):
|
14 | 14 | self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message) |
15 | 15 | self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue()) |
16 | 16 | out.close() |
| 17 | |
| 18 | def test_decimal_field(self): |
| 19 | out = StringIO() |
| 20 | call_command('inspectdb', stdout=out) |
| 21 | self.assertIn("dec_field = models.DecimalField(max_digits=10, decimal_places=5)", out.getvalue()) |