﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23935	DecimalField in admin can show up as Scientific Notation	Eric	nobody	"In the django admin, if a DecimalField's value is lower than 0.000001 displays as Scientific Notation (ex: 1E-7) since python Decimals converts automatically to a scientific notation (exponential)  ex:  Decimal(""0.0000001"") = Decimal('1E-7')

this is mostly visible when using Postgresql since DecimalFields with a value of 0 are saved with the decimal precision higher than 6 , ex: 0.00000000 then in the admin instead of seeing 0 or 0.00000000 it is displayed as 0E-8

the bug can be fixed by converting the Decimal to a fixed point value in admin/utils.py:


{{{
@@ -375,7 +375,7 @@ def display_for_field(value, field):
     elif isinstance(field, (models.DateField, models.TimeField)):
         return formats.localize(value)
     elif isinstance(field, models.DecimalField):
-        return formats.number_format(value, field.decimal_places)
+        return formats.number_format(format(value, ""f""), field.decimal_places)
     elif isinstance(field, models.FloatField):
         return formats.number_format(value)
     else:
}}}

link to my branch: https://github.com/xblitz/django/tree/ticket_23935"	Bug	new	contrib.admin	1.7	Normal		DecimalField admin		Unreviewed	1	0	0	0	1	0
