bornhack-website/shop/templatetags/shop_tags.py

18 lines
379 B
Python
Raw Normal View History

from django import template
register = template.Library()
@register.filter
def currency(value):
return "{0:.2f} DKK".format(value)
2016-05-29 13:16:29 +00:00
@register.filter(is_safe=True)
def truefalseicon(value):
if value:
return "<span class='text-success'>{% bootstrap_icon 'ok' %}</span>"
else:
return "<span class='text-danger'>{% bootstrap_icon 'remove' %}</span>"