Opened 13 years ago
Closed 13 years ago
#17227 closed Bug (wontfix)
max_digits and decimal_places using "inspectdb"
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm using Oracle and have a table like this:
CREATE TABLE "TEST_TABLE" ( "NUMBER_2_0" NUMBER(2,0) )
When I use "inspectdb", the generated model looks like:
class TestTable(models.Model): number_2_0 = models.IntegerField(null=True, blank=True) class Meta: db_table = u'test_table'
But the field should be a "models.DecimalField" with "max_digits=2" and "decimal_places=0".
Change History (2)
comment:1 by , 13 years ago
Component: | Uncategorized → Core (Management commands) |
---|---|
Type: | Uncategorized → Bug |
comment:2 by , 13 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
By design, Django considers a NUMBER field with a scale of 0 as an
IntegerField
.This behavior was introduced in r11475 to fix #11049, and I think it's correct. It's better to introspect
IntegerField
s created by Django asIntegerField
s, and occasionally misinterpret aDecimalField
as anIntegerField
, than to consider allIntegerField
s asDecimalField
s.