Merge pull request #425 from pcoder/bug/3623/hosting_my_orders_header_fix

Bug/3623/hosting my orders header fix
This commit is contained in:
Pcoder 2017-08-03 23:38:22 +02:00 committed by GitHub
commit 5b8e73984e
2 changed files with 8 additions and 3 deletions

View file

@ -20,7 +20,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2"> <div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="invoice-title"> <div class="invoice-title">
<h2>{% trans "Confirm Order"%}</h2><h3 class="pull-right">{% trans "Order #"%} {{order.id}}</h3> <h2>{{page_header_text}}</h2><h3 class="pull-right">{% trans "Order #"%} {{order.id}}</h3>
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">

View file

@ -36,7 +36,6 @@ from opennebula_api.serializers import VirtualMachineSerializer, \
VirtualMachineTemplateSerializer VirtualMachineTemplateSerializer
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a backend \ CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a backend \
connection error. please try again in a few minutes." connection error. please try again in a few minutes."
@ -639,7 +638,9 @@ class PaymentVMView(LoginRequiredMixin, FormView):
email = BaseEmail(**email_data) email = BaseEmail(**email_data)
email.send() email.send()
return HttpResponseRedirect(reverse('hosting:orders', kwargs={'pk': order.id})) return HttpResponseRedirect(
"{url}?{query_params}".format(url=reverse('hosting:orders', kwargs={'pk': order.id}),
query_params='page=payment'))
else: else:
return self.form_invalid(form) return self.form_invalid(form)
@ -658,6 +659,10 @@ class OrdersHostingDetailView(PermissionRequiredMixin, LoginRequiredMixin, Detai
owner = self.request.user owner = self.request.user
manager = OpenNebulaManager(email=owner.email, manager = OpenNebulaManager(email=owner.email,
password=owner.password) password=owner.password)
if self.request.GET.get('page', '') == 'payment':
context['page_header_text'] = _('Confirm Order')
else:
context['page_header_text'] = _('Invoice')
try: try:
vm = manager.get_vm(obj.vm_id) vm = manager.get_vm(obj.vm_id)
context['vm'] = VirtualMachineSerializer(vm).data context['vm'] = VirtualMachineSerializer(vm).data