Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#35197 closed Bug (duplicate)

floatformat combined with intcomma filters misformatting in Django 4.2.10

Reported by: nathangeffen Owned by: nobody
Component: Template system Version: 4.2
Severity: Normal Keywords: intcomma, floatformat
Cc: nathangeffen Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by nathangeffen)

A security bug was removed from the intcomma template filter in Django 4.2.10. But it appears a bug was introduced that misformats numbers when the intcomma filter is combined with floatformat.
The problem is a leading comma is added to some numbers (I suspect it is numbers with exactly 3 digits).

Example code that worked in 4.2.7 but now misformatting in 4.2.10:
{{total_amount|floatformat:"2"|intcomma}}

In the attached screenshots the bug is apparent. They are the same screen displayed using 4.2.7 and 4.2.10. Note the leading comma before 3 digit numbers in the one screenshot (that's 4.2.10).

Attachments (2)

Screenshot 2024-02-15 at 12-59-39 Invoices GroundUp.png (25.6 KB ) - added by nathangeffen 10 months ago.
Screenshot 2024-02-15 at 12-58-45 Invoices GroundUp.png (26.4 KB ) - added by nathangeffen 10 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 by nathangeffen, 10 months ago

Description: modified (diff)

comment:2 by David Sanders, 10 months ago

Resolution: duplicate
Status: newclosed

Duplicate of #35172

comment:3 by nathangeffen, 10 months ago

Apologies. Missed the original bug. Thanks for fixing.

Note: See TracTickets for help on using tickets.
Back to Top