mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #35172 -- Fixed intcomma for string floats.
Thanks Warwick Brown for the report.
Regression in 55519d6cf8.
This commit is contained in:
@@ -80,6 +80,8 @@ def intcomma(value, use_l10n=True):
|
||||
if match:
|
||||
prefix = match[0]
|
||||
prefix_with_commas = re.sub(r"\d{3}", r"\g<0>,", prefix[::-1])[::-1]
|
||||
# Remove a leading comma, if needed.
|
||||
prefix_with_commas = re.sub(r"^(-?),", r"\1", prefix_with_commas)
|
||||
result = prefix_with_commas + result[len(prefix) :]
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user