Ticket #5014: inspect_decimal_field.diff
File inspect_decimal_field.diff, 1.6 KB (added by , 17 years ago) |
---|
-
django/db/backends/sqlite3/introspection.py
64 64 'smallinteger': 'SmallIntegerField', 65 65 'int': 'IntegerField', 66 66 'integer': 'IntegerField', 67 'numeric': 'DecimalField', 67 68 'text': 'TextField', 68 69 'char': 'CharField', 69 70 'date': 'DateField', … … 84 85 m = re.search(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$', key) 85 86 if m: 86 87 return ('CharField', {'max_length': int(m.group(1))}) 88 n = re.search(r'^\s*numeric\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)\s*$', key) 89 if n: 90 return ('DecimalField', {'max_digits': int(n.group(1)), 91 'decimal_places': int(n.group(2))}) 87 92 raise KeyError 88 93 89 94 DATA_TYPES_REVERSE = FlexibleFieldLookupDict() -
django/core/management/commands/inspectdb.py
80 80 if field_type == 'CharField' and row[3]: 81 81 extra_params['max_length'] = row[3] 82 82 83 if field_type == 'DecimalField' :83 if field_type == 'DecimalField' and row[4] and row[5]: 84 84 extra_params['max_digits'] = row[4] 85 85 extra_params['decimal_places'] = row[5] 86 86