From 9102796e6e3c4e29f5982e32abc353864e53d034 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 1 Jun 2016 15:27:33 +0200 Subject: [PATCH] only check if terms are checked when payment method buttons are used --- shop/views.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/shop/views.py b/shop/views.py index dd2a7fcd..d6c1e6ab 100644 --- a/shop/views.py +++ b/shop/views.py @@ -255,14 +255,13 @@ class OrderDetailView( order = self.get_object() payment_method = request.POST.get('payment_method') - if not request.POST.get('accept_terms'): - messages.error(request, "You need to accept the general terms and conditions before you can continue!") - return HttpResponseRedirect(reverse_lazy('shop:order_detail', kwargs={'pk': order.pk})) - if payment_method in order.PAYMENT_METHODS: - order.payment_method = payment_method + if not request.POST.get('accept_terms'): + messages.error(request, "You need to accept the general terms and conditions before you can continue!") + return HttpResponseRedirect(reverse_lazy('shop:order_detail', kwargs={'pk': order.pk})) - # Mark the order as closed + # Set payment method and mark the order as closed + order.payment_method = payment_method order.open = None order.save()