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:
parent
b8c50385fc
commit
3777ec0f3a
1 changed files with 8 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue