Changes between Version 2 and Version 4 of Ticket #23935


Ignore:
Timestamp:
Dec 2, 2014, 5:28:38 PM (10 years ago)
Author:
Eric
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23935

    • Property Owner changed from nobody to Eric
    • Property Status newassigned
  • Ticket #23935 – Description

    v2 v4  
    33this 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
    44
    5 the bug can be fixed by converting the Decimal to a fixed point value in admin/utils.py:
    6 
    7 
    8 {{{
    9 @@ -375,7 +375,7 @@ def display_for_field(value, field):
    10      elif isinstance(field, (models.DateField, models.TimeField)):
    11          return formats.localize(value)
    12      elif isinstance(field, models.DecimalField):
    13 -        return formats.number_format(value, field.decimal_places)
    14 +        return formats.number_format(format(value, "f"), field.decimal_places)
    15      elif isinstance(field, models.FloatField):
    16          return formats.number_format(value)
    17      else:
    18 }}}
     5the bug can be fixed by converting the Decimal to a fixed point value in django.utils.numberformat.format:
    196
    207link to my branch: https://github.com/xblitz/django/tree/ticket_23935
Back to Top