From 5672d00a2e56297ca0b1cd417c16e6a889cf382d Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 1 Jun 2016 15:16:12 +0200 Subject: [PATCH] add checkbox to accept t&c --- shop/templates/order_detail.html | 10 +++++++--- shop/views.py | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/shop/templates/order_detail.html b/shop/templates/order_detail.html index 7adc87c2..515b65b1 100644 --- a/shop/templates/order_detail.html +++ b/shop/templates/order_detail.html @@ -74,14 +74,18 @@ {% endif %}
+

Payment

{% if not order.paid %}

Your order is currently unpaid. Please pick a payment option below.

-

Once you go to the payment your order will be finalized and you -will no longer be able to change the products or quantities - so make sure -your order is correct before proceeding!

+

Once you accept the terms and go to the payment your order will be +finalized and you will no longer be able to change the products or +quantities - so make sure your order is correct before proceeding!

{% csrf_token %} +
+ +
{% bootstrap_button " Credit card" button_type="submit" button_class="btn-primary" name="payment_method" value="credit_card" %} {% bootstrap_button " Blockchain" button_type="submit" button_class="btn-primary" name="payment_method" value="blockchain" %} {% bootstrap_button " Bank transfer" button_type="submit" button_class="btn-primary" name="payment_method" value="bank_transfer" %} diff --git a/shop/views.py b/shop/views.py index 44d90265..9ac4818a 100644 --- a/shop/views.py +++ b/shop/views.py @@ -255,6 +255,10 @@ 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 & 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