bornhack-website/shop/templatetags/shop_tags.py

19 lines
438 B
Python
Raw Normal View History

from django import template
2016-05-29 13:21:55 +00:00
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def currency(value):
return "{0:.2f} DKK".format(value)
2016-05-29 13:21:55 +00:00
@register.filter()
2016-05-29 13:16:29 +00:00
def truefalseicon(value):
if value:
2016-05-29 13:25:49 +00:00
return mark_safe("<span class='text-success glyphicon glyphicon-th-ok'></span>")
2016-05-29 13:16:29 +00:00
else:
2016-05-29 13:25:49 +00:00
return mark_safe("<span class='text-success glyphicon glyphicon-th-remove'></span>")
2016-05-29 13:16:29 +00:00