bornhack-website/shop/templatetags/shop_tags.py
2016-05-29 15:35:14 +02:00

19 lines
431 B
Python

from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def currency(value):
return "{0:.2f} DKK".format(value)
@register.filter()
def truefalseicon(value):
if value:
return mark_safe("<span class='text-success glyphicon glyphicon-ok'></span>")
else:
return mark_safe("<span class='text-danger glyphicon glyphicon-remove'></span>")