Event dashboard: Use intcomma in numbers (Z#23175343) (#4687)

This commit is contained in:
Raphael Michel
2024-12-05 17:11:57 +01:00
committed by GitHub
parent 20211d2097
commit 11ab5c5eeb
3 changed files with 19 additions and 16 deletions

View File

@@ -52,12 +52,12 @@ def money_filter(value: Decimal, arg='', hide_currency=False):
# would make the numbers incorrect. If this branch executes, it's likely a bug in
# pretix, but we won't show wrong numbers!
if hide_currency:
return floatformat(value, 2)
return floatformat(value, "2g")
else:
return '{} {}'.format(arg, floatformat(value, 2))
return '{} {}'.format(arg, floatformat(value, "2g"))
if hide_currency:
return floatformat(value, places)
return floatformat(value, f"{places}g")
locale_parts = translation.get_language().split("-", 1)
locale = locale_parts[0]
@@ -70,7 +70,7 @@ def money_filter(value: Decimal, arg='', hide_currency=False):
try:
return format_currency(value, arg, locale=locale)
except:
return '{} {}'.format(arg, floatformat(value, places))
return '{} {}'.format(arg, floatformat(value, f"{places}g"))
@register.filter("money_numberfield")