From 3777ec0f3ad45b5a631bdbd7a16198d8632a7755 Mon Sep 17 00:00:00 2001 From: Grizzly Date: Fri, 20 Jul 2018 09:43:32 +0000 Subject: [PATCH] =?UTF-8?q?prise=20en=20compte=20des=20type=20non=20bool?= =?UTF-8?q?=C3=A9ens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- preferences/templatetags/design.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/preferences/templatetags/design.py b/preferences/templatetags/design.py index 5e18572f..87a0e0f8 100644 --- a/preferences/templatetags/design.py +++ b/preferences/templatetags/design.py @@ -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 = '' + else: + result = '' + return mark_safe(result) - if valeur == True: - result = '' - else: - result = '' - - return mark_safe(result) + else: # if the value is not a boolean, display it as if tick was not called + return valeur