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