do not escape our html string

This commit is contained in:
Thomas Steen Rasmussen 2016-05-29 15:21:55 +02:00
parent af184cd671
commit ef53a8149b

View file

@ -1,4 +1,5 @@
from django import template from django import template
from django.utils.safestring import mark_safe
register = template.Library() register = template.Library()
@ -8,10 +9,10 @@ def currency(value):
return "{0:.2f} DKK".format(value) return "{0:.2f} DKK".format(value)
@register.filter(is_safe=True) @register.filter()
def truefalseicon(value): def truefalseicon(value):
if value: if value:
return "<span class='text-success'>{% bootstrap_icon 'ok' %}</span>" return mark_safe("<span class='text-success'>{% bootstrap_icon 'ok' %}</span>")
else: else:
return "<span class='text-danger'>{% bootstrap_icon 'remove' %}</span>" return mark_safe("<span class='text-danger'>{% bootstrap_icon 'remove' %}</span>")