remove the solution with the filter
This commit is contained in:
parent
6ef396a6d2
commit
9120b019aa
|
@ -1,5 +1,4 @@
|
|||
{% extends "webshop/base.html" %}
|
||||
{% load cart_filters %}
|
||||
{% block section_title %}<h1>Cart</h1>{% endblock %}
|
||||
{% block content %}
|
||||
<h3>List of Items in your Shopping Cart:</h3>
|
||||
|
@ -12,8 +11,7 @@
|
|||
<th scope="col">STOCK</th>
|
||||
<th scope="col">AMOUNT</th>
|
||||
<th scope="col">PRICE p.pce.</th>
|
||||
<th scope="col">PRICE through Model</th>
|
||||
<th scope="col">PRICE through Filter</th>
|
||||
<th scope="col">POSITION PRICE</th>
|
||||
</tr>
|
||||
{% for article in articles_list %}
|
||||
<tr class="table_content">
|
||||
|
@ -31,7 +29,6 @@
|
|||
{{ currency_name }}
|
||||
</td>
|
||||
<td scope="col">{{ article.position_price }}</td>
|
||||
<td scope="col">{{ totalprice_list|lookup:article.article.id }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def lookup(d, key):
|
||||
return d[key]
|
|
@ -235,7 +235,7 @@ def cart(request):
|
|||
cart_id = False
|
||||
articles_list = ""
|
||||
prices_in_cart = []
|
||||
totalprice_list = {}
|
||||
totalprice_list = []
|
||||
total = 0
|
||||
|
||||
if not 'currency' in request.session:
|
||||
|
@ -301,9 +301,7 @@ def cart(request):
|
|||
currency,
|
||||
article.price_in_chf)
|
||||
amount = Decimal.from_float(article.amount)
|
||||
totalprice_list.update({
|
||||
article.article.id:amount * article.article.price_in_chf
|
||||
})
|
||||
totalprice_list.append(article.position_price)
|
||||
articles_list[idx] = article
|
||||
|
||||
# if cart_id and request.session['currency']:
|
||||
|
@ -326,7 +324,7 @@ def cart(request):
|
|||
# for idx, article in enumerate(articles_list):
|
||||
# prices_in_cart.append(article.article.price_in_chf)
|
||||
|
||||
total = sum(totalprice_list.values())
|
||||
total = sum(totalprice_list)
|
||||
|
||||
return render(request, 'webshop/cart.html',
|
||||
{'articles_list': articles_list,
|
||||
|
|
Loading…
Reference in New Issue