Ticket #12550: django1.2nulldecimal.patch

File django1.2nulldecimal.patch, 727 bytes (added by Jacques Beaurain <jacques.beaurain@…>, 15 years ago)

Patch fixes exception

  • contrib/admin/util.py

     
    286286    elif isinstance(field, models.BooleanField) or isinstance(field, models.NullBooleanField):
    287287        return _boolean_icon(value)
    288288    elif isinstance(field, models.DecimalField):
    289         return formats.number_format(value, field.decimal_places)
     289        if value:
     290            return formats.number_format(value, field.decimal_places)
     291        else:
     292            return EMPTY_CHANGELIST_VALUE
    290293    elif isinstance(field, models.FloatField):
    291294        return formats.number_format(value)
    292295    elif field.flatchoices:
Back to Top