From 4672c458d60cc94482dbc607b45fe084db5c1253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Fri, 2 Mar 2018 15:59:25 +0100 Subject: [PATCH 1/2] show cathegories on side of currencies and orders --- django/didgeridoo/currencies/views.py | 5 +++-- django/didgeridoo/webshop/views.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/django/didgeridoo/currencies/views.py b/django/didgeridoo/currencies/views.py index 4a5ac1f..e08c236 100644 --- a/django/didgeridoo/currencies/views.py +++ b/django/didgeridoo/currencies/views.py @@ -4,7 +4,7 @@ from currencies.models import (ExchangeRate, ExchangeRate_date, ExchangeRate_name) from currencies import exchange_rates -from django.http import JsonResponse +from webshop.utils import get_categories def currencies(request): @@ -160,9 +160,10 @@ def currencies(request): """ # know we can query our data for presentaton: ordered_currency_list = ExchangeRate.objects.order_by('name', 'date') - + category_list = get_categories() # and publish it on template: return render(request, 'currencies/index.html', {'ordered_currency_list': ordered_currency_list, + 'category_list': category_list, 'message': message}) diff --git a/django/didgeridoo/webshop/views.py b/django/didgeridoo/webshop/views.py index fa800a9..263d960 100644 --- a/django/didgeridoo/webshop/views.py +++ b/django/didgeridoo/webshop/views.py @@ -418,6 +418,7 @@ def checkout(request): def order(request, order_id): + category_list = get_categories() price_list = [] totalprice_list = [] order_position_list_zip = [] @@ -465,4 +466,5 @@ def order(request, order_id): 'order_position_list_zip': order_position_list_zip, 'total': total, 'currency_name': currency_name, + 'category_list': category_list, }) From f7e8b9cd85e06c9c9aee319a198a59b75d46338b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Fri, 2 Mar 2018 16:07:33 +0100 Subject: [PATCH 2/2] show exchangerate in checkout --- django/didgeridoo/webshop/templates/webshop/checkout.html | 8 ++++++++ django/didgeridoo/webshop/views.py | 1 + 2 files changed, 9 insertions(+) diff --git a/django/didgeridoo/webshop/templates/webshop/checkout.html b/django/didgeridoo/webshop/templates/webshop/checkout.html index f8e32b3..95ab7c3 100644 --- a/django/didgeridoo/webshop/templates/webshop/checkout.html +++ b/django/didgeridoo/webshop/templates/webshop/checkout.html @@ -59,6 +59,14 @@
{{ total }} {{ currency_name }}
+ + + +
Exchange Rate to 1 CHF:
+ +
{{ exchange_rate }}
+ +
{% csrf_token %} diff --git a/django/didgeridoo/webshop/views.py b/django/didgeridoo/webshop/views.py index 3dccb93..ea6fd80 100644 --- a/django/didgeridoo/webshop/views.py +++ b/django/didgeridoo/webshop/views.py @@ -416,6 +416,7 @@ def checkout(request): 'category_list': category_list, 'message': message, 'person': person, + 'exchange_rate': exchange_rate, })