Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Apply all decorators on view level
Artur Smęt99131ce3ab7f
diff --git a/saleor/checkout/urls.py b/saleor/checkout/urls.pyindex 627607277b..87af3473f3 100644--- a/saleor/checkout/urls.py+++ b/saleor/checkout/urls.py@@ -1,10 +1,7 @@from django.conf.urls import url-from django.views.decorators.http import require_POSTfrom . import views-remove_voucher_view = require_POST(views.discount.remove_voucher_view)-urlpatterns = [url(r'^$', views.index_view, name='index'),@@ -13,6 +10,7 @@ urlpatterns = [url(r'^shipping-method/', views.shipping_method_view,name='shipping-method'),url(r'^summary/', views.summary_view, name='summary'),- url(r'^remove_voucher/', remove_voucher_view, name='remove-voucher'),+ url(r'^remove_voucher/', views.discount.remove_voucher_view,+ name='remove-voucher'),url(r'^login/', views.login, name='login'),]diff --git a/saleor/checkout/views/discount.py b/saleor/checkout/views/discount.pyindex d9e25540ed..2646350265 100644--- a/saleor/checkout/views/discount.py+++ b/saleor/checkout/views/discount.py@@ -4,7 +4,9 @@ from django.contrib import messagesfrom django.shortcuts import redirectfrom django.template.response import TemplateResponsefrom django.utils.translation import pgettext+from django.views.decorators.http import require_POST+from ..core import load_checkoutfrom ...discount.forms import CheckoutDiscountFormfrom ...discount.models import Voucher@@ -56,6 +58,8 @@ def validate_voucher(view):return func+@require_POST+@load_checkoutdef remove_voucher_view(request, checkout, cart):next_url = request.GET.get('next', request.META['HTTP_REFERER'])del checkout.discount