8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 14:42:25 +00:00

prise en compte des type non booléens

This commit is contained in:
Grizzly 2018-07-20 09:43:32 +00:00
parent b8c50385fc
commit 3777ec0f3a

View file

@ -28,14 +28,12 @@ register = template.Library()
@register.filter(needs_autoescape=False) @register.filter(needs_autoescape=False)
def tick(valeur, autoescape=False): def tick(valeur, autoescape=False):
if autoescape: if isinstance(valeur,bool):
esc = conditional_escape if valeur == True:
else: result = '<i style="color: #1ECA18;" class="fas fa-check"></i>'
esc = lambda x: x else:
result = '<i style="color: #D10115;" class="fas fa-times"></i>'
return mark_safe(result)
if valeur == True: else: # if the value is not a boolean, display it as if tick was not called
result = '<i style="color: #1ECA18;" class="fas fa-check"></i>' return valeur
else:
result = '<i style="color: #D10115;" class="fas fa-times"></i>'
return mark_safe(result)