More tests in WEI app, but we can still go further
This commit is contained in:
parent
25e26fe8cf
commit
b7a88a387c
6 changed files with 232 additions and 37 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue