Changes between Initial Version and Version 1 of Ticket #35177
- Timestamp:
- Feb 9, 2024, 6:20:28 AM (9 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35177 – Description
initial v1 1 1 I am trying to write an admin display function (using the [https://github.com/django/django/blob/main/django/contrib/admin/decorators.py admin.display decorator]) to output the values of a float-field to 3 decimal places. 2 2 3 Seemed like this should be pretty simple, and indeed it is, **IF** you use 'old-style' Python format-strings, e.g.3 Seemed like this should be pretty simple, and indeed it is, **IF** you use [https://docs.python.org/3/library/stdtypes.html#old-string-formatting 'old-style' Python format-strings], e.g. 4 4 {{{ 5 5 class ModelFoo_Admin(admin.ModelAdmin): … … 9 9 }}} 10 10 11 However, if you use either of the more 'modern'-style Python string-formatting methods (i.e. [https://docs.python.org/3/ tutorial/inputoutput.html#the-string-format-method str.format] or [https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals formatted string-literals]), the specified string is not displayed using the specified formatting, i.e. this:11 However, if you use either of the more 'modern'-style Python string-formatting methods (i.e. [https://docs.python.org/3/library/stdtypes.html#str.format str.format] or [https://docs.python.org/3/reference/lexical_analysis.html#f-strings formatted string-literals]), the specified string is not displayed using the specified formatting, i.e. this: 12 12 {{{ 13 13 class ModelFoo_Admin(admin.ModelAdmin):