Changes between Initial Version and Version 1 of Ticket #35177


Ignore:
Timestamp:
Feb 9, 2024, 6:20:28 AM (8 months ago)
Author:
Stephen Skett
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35177 – Description

    initial v1  
    11I 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.
    22
    3 Seemed like this should be pretty simple, and indeed it is, **IF** you use 'old-style' Python format-strings, e.g.
     3Seemed 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.
    44{{{
    55class ModelFoo_Admin(admin.ModelAdmin):
     
    99}}}
    1010
    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:
     11However, 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:
    1212{{{
    1313class ModelFoo_Admin(admin.ModelAdmin):
Back to Top