Handle product_slug

This commit is contained in:
PCoder 2018-10-03 07:55:56 +02:00
parent e3bd963600
commit a4065c7e24
2 changed files with 7 additions and 4 deletions

View file

@ -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]

View file

@ -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<packages>\S+?)/$', i18n.javascript_catalog),
url(r'^product/(?P<product_slug>[\w-]+)/$', PaymentOrderView.as_view()),
url(r'^product/(?P<product_slug>[\w-]+)/$',
PaymentOrderView.as_view(),
name='show_product'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += i18n_patterns(