Get vm price and vat and pass it to context

This commit is contained in:
PCoder 2018-04-16 04:46:43 +02:00
parent 731fef8ad9
commit 1e76864821

View file

@ -766,6 +766,15 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
) )
vm = manager.get_vm(obj.vm_id) vm = manager.get_vm(obj.vm_id)
context['vm'] = VirtualMachineSerializer(vm).data context['vm'] = VirtualMachineSerializer(vm).data
price, vat = get_vm_price_with_vat(
cpu=context['vm']['cores'],
ssd_size=context['vm']['disk_size'],
memory=context['vm']['memory'],
pricing_name=(obj.vm_pricing.name
if obj.vm_pricing else 'default')
)
context['vm']['vat'] = vat
context['vm']['price'] = price + vat
except WrongIdError: except WrongIdError:
messages.error( messages.error(
self.request, self.request,