Re: [Django] #11294: Django administration Model list always shows Decimal with decimal places

8 views
Skip to first unread message

Django

unread,
Jun 6, 2013, 5:33:19 PM6/6/13
to django-...@googlegroups.com
#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.

Django

unread,
Jun 6, 2013, 5:36:26 PM6/6/13
to django-...@googlegroups.com
#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):

* cc: tomek@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/11294#comment:7>

Django

unread,
Jan 29, 2023, 2:43:06 PM1/29/23
to django-...@googlegroups.com
#11294: Django administration Model list always shows Decimal with decimal places
-------------------------------+------------------------------------
Reporter: jason@… | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: dev
Severity: Normal | Resolution: invalid

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 Durval Carvalho):

* status: new => closed
* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/11294#comment:8>

Reply all
Reply to author
Forward
0 new messages