Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Call load_checkout directly on views
Artur Smęt8c0602a21a6b
diff --git a/saleor/checkout/urls.py b/saleor/checkout/urls.pyindex 3d4cb9e9be..627607277b 100644--- a/saleor/checkout/urls.py+++ b/saleor/checkout/urls.py@@ -1,19 +1,18 @@from django.conf.urls import urlfrom django.views.decorators.http import require_POST-from .core import load_checkoutfrom . import viewsremove_voucher_view = require_POST(views.discount.remove_voucher_view)urlpatterns = [- url(r'^$', load_checkout(views.index_view), name='index'),- url(r'^shipping-address/', load_checkout(views.shipping_address_view),+ url(r'^$', views.index_view, name='index'),+ url(r'^shipping-address/', views.shipping_address_view,name='shipping-address'),- url(r'^shipping-method/', load_checkout(views.shipping_method_view),+ url(r'^shipping-method/', views.shipping_method_view,name='shipping-method'),- url(r'^summary/', load_checkout(views.summary_view), name='summary'),- url(r'^remove_voucher/', load_checkout(remove_voucher_view), name='remove-voucher'),- url(r'^login/', load_checkout(views.login), name='login'),+ url(r'^summary/', views.summary_view, name='summary'),+ url(r'^remove_voucher/', remove_voucher_view, name='remove-voucher'),+ url(r'^login/', views.login, name='login'),]diff --git a/saleor/checkout/views/__init__.py b/saleor/checkout/views/__init__.pyindex 44a0a65a3f..54a801db0b 100644--- a/saleor/checkout/views/__init__.py+++ b/saleor/checkout/views/__init__.py@@ -1,23 +1,28 @@+from allauth.account.forms import LoginFormfrom django.shortcuts import redirectfrom django.template.response import TemplateResponse-from ..forms import ShippingMethodFormfrom .discount import add_voucher_form, validate_voucher+from .shipping import (anonymous_user_shipping_address_view,+ user_shipping_address_view)+from .summary import (+ summary_with_shipping_view, anonymous_summary_without_shipping,+ summary_without_shipping)from .validators import (validate_cart, validate_shipping_address,validate_shipping_method, validate_is_shipping_required)-from .shipping import anonymous_user_shipping_address_view, user_shipping_address_view-from .summary import summary_with_shipping_view, anonymous_summary_without_shipping, \- summary_without_shipping+from ..core import load_checkout+from ..forms import ShippingMethodForm-from allauth.account.forms import LoginForm+@load_checkout@validate_cart@validate_is_shipping_requireddef index_view(request, checkout):return redirect('checkout:shipping-address')+@load_checkout@validate_voucher@validate_cart@validate_is_shipping_required@@ -28,6 +33,7 @@ def shipping_address_view(request, checkout):return anonymous_user_shipping_address_view(request, checkout)+@load_checkout@validate_voucher@validate_cart@validate_is_shipping_required@@ -44,6 +50,7 @@ def shipping_method_view(request, checkout):'shipping_method_form': shipping_method_form, 'checkout': checkout})+@load_checkout@validate_voucher@validate_cart@add_voucher_form@@ -58,6 +65,7 @@ def summary_view(request, checkout):return anonymous_summary_without_shipping(request, checkout)+@load_checkout@validate_cartdef login(request, checkout):if request.user.is_authenticated: