Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Simplify checkout views
Michal Ociepkaa902256ec959
diff --git a/checkout/urls.py b/checkout/urls.pyindex 371d2afd29..dea50eb5b6 100644--- a/checkout/urls.py+++ b/checkout/urls.py@@ -2,7 +2,7 @@ from django.conf.urls import patterns, urlurlpatterns = patterns('checkout.views',- url(r'^$', 'index', name='index'),+ url(r'^$', 'details', kwargs={'step': None}, name='index'),url(r'^(?P<step>[a-z0-9-]+)/$', 'details', name='details'))diff --git a/checkout/views.py b/checkout/views.pyindex 3b40c0d9a2..2d6624ce21 100644--- a/checkout/views.py+++ b/checkout/views.py@@ -3,17 +3,12 @@ from django.http.response import Http404from django.shortcuts import redirect-def index(request):- if not request.cart:- return redirect('cart:index')- checkout = Checkout(request)- return redirect(checkout.get_next_step())--def details(request, step):if not request.cart:return redirect('cart:index')checkout = Checkout(request)+ if not step:+ return redirect(checkout.get_next_step())try:step = checkout[step]except KeyError: