Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [#37] Changed condition in the template #38

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/bobvance/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from django.views.generic import DetailView, FormView, ListView, TemplateView, View

from bobvance.base.forms import CustomerForm
from bobvance.base.models import Customer, Order, OrderProduct, Product
from bobvance.base.models import Order, OrderProduct, Product

from decimal import Decimal


class Home(TemplateView):
Expand Down Expand Up @@ -68,8 +70,8 @@ def get(self, request, *args, **kwargs):
[product.price * cart[str(product.id)] for product in cart_items]
)

shipping_price = 25
if total_price <= 500:
shipping_price = 25
if total_price <= Decimal('500'):
total_price += shipping_price

context = {
Expand Down
2 changes: 1 addition & 1 deletion src/bobvance/templates/base/cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h2 class="text-lg font-bold text-gray-900">{{ item.product.name }}</h2>
</div>
<div class="flex justify-between">
<p class="text-gray-700">Verzenden</p>
{% if shipping_price %}
{% if total_price <= 500 %}
<p class="text-gray-700">鈧瑊{ shipping_price }}</p>
{% else %}
<p class="text-gray-700">Gratis</p>
Expand Down
Loading