mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 09:58:23 +02:00
More tests in WEI app, but we can still go further
This commit is contained in:
@ -5,17 +5,20 @@ from django import template
|
||||
|
||||
|
||||
def pretty_money(value):
|
||||
if value % 100 == 0:
|
||||
return "{:s}{:d} €".format(
|
||||
"- " if value < 0 else "",
|
||||
abs(value) // 100,
|
||||
)
|
||||
else:
|
||||
return "{:s}{:d}.{:02d} €".format(
|
||||
"- " if value < 0 else "",
|
||||
abs(value) // 100,
|
||||
abs(value) % 100,
|
||||
)
|
||||
try:
|
||||
if value % 100 == 0:
|
||||
return "{:s}{:d} €".format(
|
||||
"- " if value < 0 else "",
|
||||
abs(value) // 100,
|
||||
)
|
||||
else:
|
||||
return "{:s}{:d}.{:02d} €".format(
|
||||
"- " if value < 0 else "",
|
||||
abs(value) // 100,
|
||||
abs(value) % 100,
|
||||
)
|
||||
except (ValueError, TypeError):
|
||||
return "0 €"
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
Reference in New Issue
Block a user