8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +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
else:
esc = lambda x: x
if valeur == True: if valeur == True:
result = '<i style="color: #1ECA18;" class="fas fa-check"></i>' result = '<i style="color: #1ECA18;" class="fas fa-check"></i>'
else: else:
result = '<i style="color: #D10115;" class="fas fa-times"></i>' result = '<i style="color: #D10115;" class="fas fa-times"></i>'
return mark_safe(result) return mark_safe(result)
else: # if the value is not a boolean, display it as if tick was not called
return valeur