Merge branch 'master' of git.2li.ch:ibz/web_AI-5

This commit is contained in:
Andreas Zweili 2018-03-02 16:08:23 +01:00
commit 92d4e0dd71
3 changed files with 14 additions and 2 deletions

View File

@ -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})

View File

@ -59,6 +59,14 @@
<dt><dl>{{ total }} {{ currency_name }}</dl></dt>
</td>
</tr>
<tr>
<td scope="col" colspan="5" class="text-right">
<td scope="col" class="price-value">
<dt><dl>Exchange Rate to 1 CHF:</dl></dt></td>
<td scope="col" class="price-value">
<dt><dl>{{ exchange_rate }}</dl></dt>
</td>
</tr>
</table>
<form id="checkout_form" action="{% url 'cart' %}" method="POST">
{% csrf_token %}

View File

@ -416,10 +416,12 @@ def checkout(request):
'category_list': category_list,
'message': message,
'person': person,
'exchange_rate': exchange_rate,
})
def order(request, order_id):
category_list = get_categories()
totalprice_list = []
order_position_list = []
cart = ShoppingCart.objects.get(user=request.user)
@ -457,4 +459,5 @@ def order(request, order_id):
'order_position_list': order_positions,
'total': total,
'currency_name': currency_name,
'category_list': category_list,
})