Redirect to review if the order is closed but not paid. Also remove the option to remove products when the order is closed.
This commit is contained in:
parent
effd900b62
commit
3ba33649cb
|
@ -26,7 +26,9 @@
|
||||||
Price
|
Price
|
||||||
<th>
|
<th>
|
||||||
Total
|
Total
|
||||||
|
{% if not order.open == None %}
|
||||||
<th></th>
|
<th></th>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for form in order_product_formset %}
|
{% for form in order_product_formset %}
|
||||||
|
@ -47,8 +49,10 @@
|
||||||
{{ form.instance.product.price|currency }}
|
{{ form.instance.product.price|currency }}
|
||||||
<td>
|
<td>
|
||||||
{{ form.instance.total|currency }}
|
{{ form.instance.total|currency }}
|
||||||
|
{% if not order.open == None %}
|
||||||
<td>
|
<td>
|
||||||
{% bootstrap_button '<i class="glyphicon glyphicon-remove"></i>' button_type="submit" button_class="btn-danger" name="remove_product" value=form.instance.pk %}
|
{% bootstrap_button '<i class="glyphicon glyphicon-remove"></i>' button_type="submit" button_class="btn-danger" name="remove_product" value=form.instance.pk %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
|
|
||||||
{% block profile_content %}
|
{% block profile_content %}
|
||||||
|
|
||||||
|
{% if order.open is not None %}
|
||||||
<div>
|
<div>
|
||||||
Not ready to pay for your order yet?
|
Not ready to pay for your order yet?
|
||||||
<a href="{% url "shop:order_detail" pk=order.pk %}">Go back and edit it</a>
|
<a href="{% url "shop:order_detail" pk=order.pk %}">Go back and edit it</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
@ -18,7 +19,11 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
{% if order.open is not None %}
|
||||||
Please review your order to make sure the quantities are right.
|
Please review your order to make sure the quantities are right.
|
||||||
|
{% else %}
|
||||||
|
This order is closed, but not paid.
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
|
|
|
@ -275,6 +275,14 @@ class OrderDetailView(
|
||||||
template_name = "order_detail.html"
|
template_name = "order_detail.html"
|
||||||
context_object_name = "order"
|
context_object_name = "order"
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
order = self.get_object()
|
||||||
|
if order.open is None and not order.paid:
|
||||||
|
return HttpResponseRedirect(
|
||||||
|
reverse("shop:order_review_and_pay", kwargs={"pk": order.pk})
|
||||||
|
)
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
if "order_product_formset" not in kwargs:
|
if "order_product_formset" not in kwargs:
|
||||||
kwargs["order_product_formset"] = OrderProductRelationFormSet(
|
kwargs["order_product_formset"] = OrderProductRelationFormSet(
|
||||||
|
|
Loading…
Reference in a new issue