#35177: Admin.display decorator functions do not output correct-format for
'modern'
Python string-formatting
-------------------------------------+-------------------------------------
Reporter: Stephen Skett | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution: invalid
Keywords: admin, display, | Triage Stage:
string, format, | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):
* status: new => closed
* resolution: => invalid
Comment:
Hi,
The equivalent of `"%.3f" % obj.bar` is `"{0:.3f}".format(obj.bar)` (note
the added `.`).
What you're doing with `"{0:3f}".format(obj.bar)` is making sure the final
string is at least 3 characters long, using the default 6 decimal places
(try replacing the `3` by a `10` for example, you'll see extra spaces at
the beginning of the string).
So Django is not doing anything weird here.
--
Ticket URL: <https://code.djangoproject.com/ticket/35177#comment:2>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018d8eefa057-20cfad13-dfc9-4ebb-9255-96af7d422cba-000000%40eu-central-1.amazonses.com.