From 93fed32cad0fadf9d2310eb126e5f14d3a560b52 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 29 May 2016 15:16:29 +0200 Subject: [PATCH] styling order list page --- shop/templates/order_list.html | 6 +++--- shop/templatetags/shop_tags.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/shop/templates/order_list.html b/shop/templates/order_list.html index 5cb88c17..41d65117 100644 --- a/shop/templates/order_list.html +++ b/shop/templates/order_list.html @@ -22,9 +22,9 @@ {{ order.id }} {{ order.get_number_of_items }} {{ order.total|currency }} - {{ order.open }} - {{ order.paid }} - {{ order.handed_out_status }} + {{ order.open|truefalseicon }} + {{ order.paid|truefalseicon }} + {{ order.handed_out_status }} {% url 'shop:order_detail' pk=order.pk as order_detail_url %} {% bootstrap_button "Order details" icon="th-list" href=order_detail_url button_class="btn-primary btn-sm" %} diff --git a/shop/templatetags/shop_tags.py b/shop/templatetags/shop_tags.py index 2aa6b95f..53eba18b 100644 --- a/shop/templatetags/shop_tags.py +++ b/shop/templatetags/shop_tags.py @@ -8,3 +8,10 @@ def currency(value): return "{0:.2f} DKK".format(value) +@register.filter(is_safe=True) +def truefalseicon(value): + if value: + return "{% bootstrap_icon 'ok' %}" + else: + return "{% bootstrap_icon 'remove' %}" +