Opened 19 years ago

Closed 19 years ago

#1289 closed enhancement (fixed)

Inspectdb improvement of mysql extra_params for FloatFields and IntegerFields

Reported by: gandalf@… Owned by: Adrian Holovaty
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

When inspectdb is used with mysql it can also figure out the number of decimal places for FloatFields and integer places for IntegerFields.

the addition to inspectdb in manager.py is:

                if field_type == 'FloatField':
                    extra_params['decimal_places'] = row[5]

                if field_type =='IntegerField':
                    extra_params['max_digits'] = row[3]

I was not able to figure out how to get max_digits for FloatFields, suggestions welcome.

Change History (2)

comment:1 by gandalf@…, 19 years ago

Ups, I was a bit hasty. IntegerField does not support max_digits even though you can limit this in MySql.

So the correct addition would be:

                if field_type == 'FloatField':
                    extra_params['decimal_places'] = row[5]

comment:2 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [2356]) Fixed #1289 -- Improved 'inspectdb' to introspect decimal_places and max_digits for FloatFields. Thanks, gandalf@…

Note: See TracTickets for help on using tickets.
Back to Top