Opened 10 years ago

Closed 9 years ago

#1289 closed enhancement (fixed)

Inspectdb improvement of mysql extra_params for FloatFields and IntegerFields

Reported by: gandalf@… Owned by: adrian
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: UI/UX:

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 Changed 10 years ago by gandalf@…

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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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