1
0
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:
Yohann D'ANELLO
2020-08-11 01:03:29 +02:00
parent 25e26fe8cf
commit b7a88a387c
6 changed files with 232 additions and 37 deletions

View File

@ -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()