#11294: Django administration Model list always shows Decimal with decimal
places
-------------------------------+------------------------------------
Reporter: jason@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by oinopion):
* version: 1.1-beta => master
Comment:
The problem here is two folds:
1. By default, admin will not localize input values. Not localized input
is rendered as `str(value)`, which is `Decimal.__str__`. List display uses
`display_for_field`, which localizes value if I18N is on.
2. When forced to localize (by settings `ModelForm._opts.localized_fields
= '__all__'`), decimal input still does not honour
`DecimalField.decimal_places` and is displayed differently from list.
Fix for 2. is easy, overriding `_format_value` in NumberInput to correctly
use `number_format` with `decimal_places`.
Fix for 1. is not easy, if not impossible, tickets #13032 and #13546
mention problems with localizing inputs by default. At least we can better
document current admin behaviour and include instructions to change it.
Better yet, would be to include another `ModelAdmin` option to control
`localized_fields` in generated `ModelForm` classes.
--
Ticket URL: <https://code.djangoproject.com/ticket/11294#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/076.13adeec272aa891317af24a9cd0b35da%40djangoproject.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.