Merge branch 'cart' of https://git.2li.ch/ibz/web_AI-5 into cart

This commit is contained in:
Andreas Zweili 2018-02-04 20:04:12 +01:00
commit 14095a7f63
2 changed files with 26 additions and 5 deletions

View File

@ -2,8 +2,29 @@
{% block section_title %}<h1>Cart</h1>{% endblock %}
{% block content %}
<h3>List of Items in your Shopping Cart:</h3>
<p>{{ article.description }}</p>
<p><b>in Stock:</b> {{ article.stock }}</p>
<p><b>Amount you whant:</b> {{ article.amount }}</p>
<p><b>Price:</b> {{ article.price_in_chf }} {{ currency_name }}</p>
{% if articles_list %}
<table class="table">
<tr class="table_header">
<th scope="col">ID</th>
<th scope="col">NAME</th>
<th scope="col">STOCK</th>
<th scope="col">PRICE</th>
</tr>
{% for article in articles_list %}
<tr class="table_content">
<td scope="col">{{ article.id }}</td>
<td scope="col">
<a href="{% url 'details' article.id %}">
{{ article.article.name }}
</a></td>
<td scope="col">{{ article.article.stock }}</td>
<td scope="col">{{ article.article.price_in_chf }} {{ currency_name }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p class="alert">
There are currently no articles in your cart.
</p>
{% endif %}
{% endblock %}

View File

@ -262,7 +262,7 @@ def cart(request):
article.price_in_chf = rate.exchange(currency, article.price_in_chf)
return render(request, 'webshop/cart.html',
{'article': article,
{'articles_list': articles_list,
'currencies_form': currencies_form,
'article_view': article_view,
'currency_name': currency_name,