Obtain product_slug from session
Obtaining slug from kwargs won't work in OrderConfirmation page because we do not set the kwargs for that page. To resolve this, I add the product_slug to the generic_payment_details dict in the session
This commit is contained in:
parent
2b7d4bbef5
commit
5985ded36f
1 changed files with 26 additions and 17 deletions
|
@ -571,10 +571,12 @@ class OrderConfirmationView(DetailView):
|
||||||
response = {
|
response = {
|
||||||
'status': False,
|
'status': False,
|
||||||
'redirect': "{url}#{section}".format(
|
'redirect': "{url}#{section}".format(
|
||||||
url=(reverse('show_product', kwargs={
|
url=(reverse(
|
||||||
'product_slug': kwargs['product_slug']}
|
'show_product',
|
||||||
) if 'generic_payment_details' in
|
kwargs={'product_slug':
|
||||||
request.session else
|
request.session['generic_payment_details']
|
||||||
|
['product_slug']}
|
||||||
|
) if 'generic_payment_details' in request.session else
|
||||||
reverse('datacenterlight:payment')
|
reverse('datacenterlight:payment')
|
||||||
),
|
),
|
||||||
section='payment_error'),
|
section='payment_error'),
|
||||||
|
@ -615,8 +617,12 @@ class OrderConfirmationView(DetailView):
|
||||||
response = {
|
response = {
|
||||||
'status': False,
|
'status': False,
|
||||||
'redirect': "{url}#{section}".format(
|
'redirect': "{url}#{section}".format(
|
||||||
url=(reverse('show_product', kwargs={
|
url=(reverse(
|
||||||
'product_slug': kwargs['product_slug']}
|
'show_product',
|
||||||
|
kwargs={'product_slug':
|
||||||
|
request.session
|
||||||
|
['generic_payment_details']
|
||||||
|
['product_slug']}
|
||||||
) if 'generic_payment_details' in
|
) if 'generic_payment_details' in
|
||||||
request.session else
|
request.session else
|
||||||
reverse('datacenterlight:payment')
|
reverse('datacenterlight:payment')
|
||||||
|
@ -676,7 +682,7 @@ class OrderConfirmationView(DetailView):
|
||||||
'status': False,
|
'status': False,
|
||||||
'redirect': "{url}#{section}".format(
|
'redirect': "{url}#{section}".format(
|
||||||
url=(reverse('show_product', kwargs={
|
url=(reverse('show_product', kwargs={
|
||||||
'product_slug': kwargs['product_slug']}
|
'product_slug': gp_details['product_slug']}
|
||||||
) if 'generic_payment_details' in
|
) if 'generic_payment_details' in
|
||||||
request.session else
|
request.session else
|
||||||
reverse('datacenterlight:payment')
|
reverse('datacenterlight:payment')
|
||||||
|
@ -751,13 +757,16 @@ class OrderConfirmationView(DetailView):
|
||||||
response = {
|
response = {
|
||||||
'status': False,
|
'status': False,
|
||||||
'redirect': "{url}#{section}".format(
|
'redirect': "{url}#{section}".format(
|
||||||
url=(reverse('show_product', kwargs={
|
url=(reverse(
|
||||||
'product_slug': kwargs['product_slug']}
|
'show_product',
|
||||||
) if 'generic_payment_details' in
|
kwargs={'product_slug':
|
||||||
request.session else
|
request.session['generic_payment_details']
|
||||||
|
['product_slug']}
|
||||||
|
) if 'generic_payment_details' in request.session else
|
||||||
reverse('datacenterlight:payment')
|
reverse('datacenterlight:payment')
|
||||||
),
|
),
|
||||||
section='payment_error'),
|
section='payment_error'
|
||||||
|
),
|
||||||
'msg_title': str(_('Error.')),
|
'msg_title': str(_('Error.')),
|
||||||
'msg_body': str(
|
'msg_body': str(
|
||||||
_('There was a payment related error.'
|
_('There was a payment related error.'
|
||||||
|
|
Loading…
Reference in a new issue