From a4065c7e24371859711468fe83af4ae379abbe27 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Oct 2018 07:55:56 +0200 Subject: [PATCH] Handle product_slug --- datacenterlight/views.py | 7 ++++--- dynamicweb/urls.py | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index e9babd74..606a9b61 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -268,8 +268,9 @@ class PaymentOrderView(FormView): @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): - if 'type' in request.GET and request.GET['type'] == 'generic': - request.session['generic_payment_type'] = request.GET['type'] + if (('type' in request.GET and request.GET['type'] == 'generic') + or 'product_slug' in kwargs): + request.session['generic_payment_type'] = 'generic' if 'generic_payment_details' in request.session: request.session.pop('generic_payment_details') if 'product_slug' in kwargs: @@ -897,7 +898,7 @@ class OrderConfirmationView(DetailView): for session_var in ['specs', 'template', 'billing_address', 'billing_address_data', 'card_id', 'token', 'customer', 'generic_payment_type', - 'generic_payment_details']: + 'generic_payment_details', 'product_slug']: if session_var in request.session: del request.session[session_var] diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index 0fadb91b..37bb69a4 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -30,7 +30,9 @@ urlpatterns = [ url(r'^nosystemd/', include('nosystemd.urls', namespace="nosystemd")), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), url(r'^jsi18n/(?P\S+?)/$', i18n.javascript_catalog), - url(r'^product/(?P[\w-]+)/$', PaymentOrderView.as_view()), + url(r'^product/(?P[\w-]+)/$', + PaymentOrderView.as_view(), + name='show_product'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += i18n_patterns(