From ca0ed4fb279fc259a86dce8562c572c32f158f82 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 21 Jul 2019 16:27:25 +0200 Subject: [PATCH] redirect back to shop after adding something to an order, and make link to shopping cart bigger --- src/shop/templates/shop_base.html | 17 +++++------------ src/shop/views.py | 4 +--- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/shop/templates/shop_base.html b/src/shop/templates/shop_base.html index d7b8b0a3..58b19058 100644 --- a/src/shop/templates/shop_base.html +++ b/src/shop/templates/shop_base.html @@ -16,21 +16,14 @@ {% if user.creditnotes.exists %}
  • Credit Notes
  • {% endif %} -
  • Orders
  • + {% if current_order %}
  • - - {% if current_order and current_order.get_number_of_items %} - {% endif %} - - - - {{ current_order.get_number_of_items|default:0 }} - - {% if current_order and current_order.get_number_of_items %} - - {% endif %} + Shopping Cart ({{ current_order.get_number_of_items|default:0 }} items)
  • + {% else %} +
  • Show Orders
  • + {% endif %} {% endif %} diff --git a/src/shop/views.py b/src/shop/views.py index 36515079..62f08f00 100644 --- a/src/shop/views.py +++ b/src/shop/views.py @@ -249,9 +249,7 @@ class ProductDetailView(FormView, DetailView): return super(ProductDetailView, self).form_valid(form) def get_success_url(self): - return Order.objects.get( - user=self.request.user, open__isnull=False - ).get_absolute_url() + return reverse("shop:index") class OrderListView(LoginRequiredMixin, ListView):