Using VMDetail model to show order details
This commit is contained in:
parent
f2213305f6
commit
7fcece40c1
1 changed files with 23 additions and 19 deletions
|
@ -680,25 +680,29 @@ class OrdersHostingDetailView(LoginRequiredMixin,
|
||||||
if obj is not None:
|
if obj is not None:
|
||||||
# invoice for previous order
|
# invoice for previous order
|
||||||
try:
|
try:
|
||||||
manager = OpenNebulaManager(
|
vm_detail = VMDetail.objects.get(vm_id=obj.vm_id)
|
||||||
email=owner.email, password=owner.password
|
context['vm'] = vm_detail.__dict__
|
||||||
)
|
except VMDetail.DoesNotExist:
|
||||||
vm = manager.get_vm(obj.vm_id)
|
try:
|
||||||
context['vm'] = VirtualMachineSerializer(vm).data
|
manager = OpenNebulaManager(
|
||||||
except WrongIdError:
|
email=owner.email, password=owner.password
|
||||||
messages.error(
|
)
|
||||||
self.request,
|
vm = manager.get_vm(obj.vm_id)
|
||||||
_('The VM you are looking for is unavailable at the '
|
context['vm'] = VirtualMachineSerializer(vm).data
|
||||||
'moment. Please contact Data Center Light support.')
|
except WrongIdError:
|
||||||
)
|
messages.error(
|
||||||
self.kwargs['error'] = 'WrongIdError'
|
self.request,
|
||||||
context['error'] = 'WrongIdError'
|
_('The VM you are looking for is unavailable at the '
|
||||||
except ConnectionRefusedError:
|
'moment. Please contact Data Center Light support.')
|
||||||
messages.error(
|
)
|
||||||
self.request,
|
self.kwargs['error'] = 'WrongIdError'
|
||||||
_('In order to create a VM, you need to create/upload '
|
context['error'] = 'WrongIdError'
|
||||||
'your SSH KEY first.')
|
except ConnectionRefusedError:
|
||||||
)
|
messages.error(
|
||||||
|
self.request,
|
||||||
|
_('In order to create a VM, you need to create/upload '
|
||||||
|
'your SSH KEY first.')
|
||||||
|
)
|
||||||
elif not card_details.get('response_object'):
|
elif not card_details.get('response_object'):
|
||||||
# new order, failed to get card details
|
# new order, failed to get card details
|
||||||
context['failed_payment'] = True
|
context['failed_payment'] = True
|
||||||
|
|
Loading…
Reference in a new issue