fix customer comment error when changing payment method for an order with empty comment
This commit is contained in:
parent
25aba076fb
commit
850de5554f
|
@ -277,13 +277,7 @@ class OrderListView(LoginRequiredMixin, ListView):
|
|||
return queryset.filter(user=self.request.user).not_cancelled()
|
||||
|
||||
|
||||
class OrderDetailView(
|
||||
LoginRequiredMixin,
|
||||
EnsureUserOwnsOrderMixin,
|
||||
EnsureOrderHasProductsMixin,
|
||||
EnsureOrderIsNotCancelledMixin,
|
||||
DetailView
|
||||
):
|
||||
class OrderDetailView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureOrderHasProductsMixin, EnsureOrderIsNotCancelledMixin, DetailView):
|
||||
model = Order
|
||||
template_name = 'order_detail.html'
|
||||
context_object_name = 'order'
|
||||
|
@ -300,7 +294,7 @@ class OrderDetailView(
|
|||
# Set payment method and mark the order as closed
|
||||
order.payment_method = payment_method
|
||||
order.open = None
|
||||
order.customer_comment = request.POST.get('customer_comment')
|
||||
order.customer_comment = request.POST.get('customer_comment') or ''
|
||||
order.save()
|
||||
|
||||
reverses = {
|
||||
|
@ -331,7 +325,7 @@ class OrderDetailView(
|
|||
new_quantity = int(request.POST.get(order_product_id))
|
||||
order_product.quantity = new_quantity
|
||||
order_product.save()
|
||||
order.customer_comment = request.POST.get('customer_comment')
|
||||
order.customer_comment = request.POST.get('customer_comment') or ''
|
||||
order.save()
|
||||
|
||||
product_remove = request.POST.get('remove_product')
|
||||
|
|
Loading…
Reference in a new issue