From 6b2dc28ea333120d88488db17e7294145b725b23 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Thu, 16 Aug 2012 19:56:33 +0200 Subject: [PATCH] Reciept --- main/urls.py | 1 + main/views.py | 9 +++++++++ templates/log.html | 2 +- templates/nav.html | 4 ++-- templates/order_reciept.html | 22 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 templates/order_reciept.html diff --git a/main/urls.py b/main/urls.py index 6eeb2d2..b45291c 100644 --- a/main/urls.py +++ b/main/urls.py @@ -13,4 +13,5 @@ urlpatterns = patterns('main.views', url(r'^stats/products/(?P[0-9]+)/$', 'stats_products', name='stats-product'), url(r'^products/(?P[0-9]+)/$', 'products', name='json-product'), url(r'^products/$', 'products', name='json-products'), + url(r'^order/(?P[0-9]+)/$', 'order_reciept', name='order_reciept'), ) diff --git a/main/views.py b/main/views.py index 40f89e3..fa14b03 100755 --- a/main/views.py +++ b/main/views.py @@ -263,3 +263,12 @@ def users_format_js(users): users_js = u"[{0}]".format(u",".join(users_js)) return users_js +def order_reciept(request, order): + order = Order.objects.get(pk=order) + orderlines = OrderLine.objects.filter(order=order) + for line in orderlines: + line.tot = line.amount * line.unit_price + + print order.order_sum + + return render_to_response('order_reciept.html', locals(), context_instance=RequestContext(request)) diff --git a/templates/log.html b/templates/log.html index 4fdeb29..262c438 100644 --- a/templates/log.html +++ b/templates/log.html @@ -41,7 +41,7 @@ {% for line in order.orderline_set.all %} {{ line.amount}} {{ line.product }}{% if not forloop.last %}, {% endif %}{% endfor %} {{ order.order_sum }} - {% include "modal-delete-order.html" with order=order %} Slett + Kvittering {% include "modal-delete-order.html" with order=order %} Slett {% endfor %} diff --git a/templates/nav.html b/templates/nav.html index abf9bd2..59145e9 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -7,11 +7,11 @@ - Biceps Bar System - BBS + KAKtoffelbodens flotte campingkasse [BBS]