From 8deed169ca6c5d223f28bd63dce5e0e9ba474951 Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 1 Jan 2021 11:12:56 +0530 Subject: [PATCH] Fix redirect url Take user to virtual_machines page if the user ordered a VM --- datacenterlight/views.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 9f31952e..ea39cd9c 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -1027,6 +1027,14 @@ class OrderConfirmationView(DetailView, FormView): latest_invoice.payment_intent ) # TODO: requires_attention is probably wrong value to compare + if request.user.is_authenticated(): + if 'generic_payment_details' in request.session: + redirect_url = reverse('hosting:invoices') + else: + redirect_url = reverse('hosting:virtual_machines') + else: + redirect_url = reverse('datacenterlight:index') + if (pi.status == 'requires_attention' or pi.status == 'requires_source_action'): logger.debug("Display SCA authentication %s " % pi.status) @@ -1037,11 +1045,7 @@ class OrderConfirmationView(DetailView, FormView): 'showSCA': True, 'success': { 'status': True, - 'redirect': ( - reverse('hosting:invoices') - if request.user.is_authenticated() - else reverse('datacenterlight:index') - ), + 'redirect': redirect_url, 'msg_title': str(_('Thank you for the order.')), 'msg_body': str( _('Your product will be provisioned as soon as'