From 39cb9303267e5d1aedb278e85b28a1336f72c8d5 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 28 Sep 2017 04:22:15 +0530 Subject: [PATCH] Compute vm price on post of dcl index and set in session --- datacenterlight/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index e374b90e..308913b0 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -262,11 +262,13 @@ class IndexView(CreateView): extra_tags='storage') return HttpResponseRedirect( reverse('datacenterlight:index') + "#order_form") - + amount_to_be_charged = get_vm_price(cpu=cores, memory=memory, + disk_size=storage) specs = { 'cpu': cores, 'memory': memory, 'disk_size': storage, + 'price': amount_to_be_charged } request.session['specs'] = specs request.session['template'] = template_data @@ -477,9 +479,7 @@ class OrderConfirmationView(DetailView): cpu = specs.get('cpu') memory = specs.get('memory') disk_size = specs.get('disk_size') - amount_to_be_charged = get_vm_price(cpu=cpu, memory=memory, - disk_size=disk_size) - specs['price'] = amount_to_be_charged + amount_to_be_charged = specs.get('price') plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu, memory=memory, disk_size=disk_size)