redirect back to shop after adding something to an order, and make link to shopping cart bigger

This commit is contained in:
Thomas Steen Rasmussen 2019-07-21 16:27:25 +02:00
parent 8de597d5e5
commit ca0ed4fb27
2 changed files with 6 additions and 15 deletions

View file

@ -16,21 +16,14 @@
{% if user.creditnotes.exists %} {% if user.creditnotes.exists %}
<li class="pull-right"><a href="{% url 'shop:creditnote_list' %}">Credit Notes</a></li> <li class="pull-right"><a href="{% url 'shop:creditnote_list' %}">Credit Notes</a></li>
{% endif %} {% endif %}
<li class="pull-right"><a href="{% url 'shop:order_list' %}">Orders</a></li> {% if current_order %}
<li class="pull-right no-before"> <li class="pull-right no-before">
{% if current_order and current_order.get_number_of_items %}
<a href="{% url 'shop:order_detail' pk=current_order.pk %}"> <a href="{% url 'shop:order_detail' pk=current_order.pk %}">
{% endif %} <i class="glyphicon glyphicon-shopping-cart"></i> Shopping Cart ({{ current_order.get_number_of_items|default:0 }} items)</a>
<i class="glyphicon glyphicon-shopping-cart"></i>
<span class="badge">
{{ current_order.get_number_of_items|default:0 }}
</span>
{% if current_order and current_order.get_number_of_items %}
</a>
{% endif %}
</li> </li>
{% else %}
<li class="pull-right no-before"><a href="{% url 'shop:order_list' %}">Show Orders</a></li>
{% endif %}
{% endif %} {% endif %}
</ol> </ol>
</div> </div>

View file

@ -249,9 +249,7 @@ class ProductDetailView(FormView, DetailView):
return super(ProductDetailView, self).form_valid(form) return super(ProductDetailView, self).form_valid(form)
def get_success_url(self): def get_success_url(self):
return Order.objects.get( return reverse("shop:index")
user=self.request.user, open__isnull=False
).get_absolute_url()
class OrderListView(LoginRequiredMixin, ListView): class OrderListView(LoginRequiredMixin, ListView):