Opened 8 years ago

Closed 8 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:


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 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.

Attachments (0)

Change History (2)

comment:1 Changed 8 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 8 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@…

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.