From 10e8f0a8205de46b133f8dcd9bd89d7f21c229ec Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 26 Sep 2018 09:10:15 +0200 Subject: [PATCH] Show product name in hosting order detail --- hosting/templates/hosting/order_detail.html | 13 ++++++++++--- hosting/views.py | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 0cbe103e..0f92ef67 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -166,12 +166,22 @@ {% else %} +

+ {% trans "Product" %}:  + {{ product_name }} +

{% trans "Amount" %}: {{order.price|floatformat:2|intcomma}} CHF

+ {% if order.generic_payment_description %} +

+ {% trans "Description" %}: + {{order.generic_payment_description}} +

+ {% endif %} {% if order.subscription_id %}

{% trans "Recurring" %}: @@ -179,9 +189,6 @@

{% endif %}
-
-
-
{% endif %} diff --git a/hosting/views.py b/hosting/views.py index 8b6e061d..c9b7ab08 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -59,7 +59,8 @@ from .forms import ( ) from .mixins import ProcessVMSelectionMixin, HostingContextMixin from .models import ( - HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail + HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail, + GenericProduct ) logger = logging.getLogger(__name__) @@ -865,7 +866,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): if obj.generic_product_id is not None: # generic payment case logger.debug("Generic payment case") - + context['product_name'] = GenericProduct.objects.get( + id=obj.generic_product_id + ).product_name else: # invoice for previous order logger.debug("Invoice of VM order")