discount name in templates

This commit is contained in:
Arvind Tiwari 2018-05-07 06:25:50 +05:30
commit eeed9b2e72
5 changed files with 15 additions and 11 deletions

View file

@ -138,11 +138,11 @@
<span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span>
</p>
{% endif %}
{% if vm_pricing.discount_amount %}
{% if vm.discount > 0 %}
<p class="text-primary">
{%trans "Discount" as discount_name %}
<span>{{ vm_pricing.discount_name|default:discount_name }}: </span>
<span class="pull-right">- {{ vm_pricing.discount_amount }} CHF</span>
<span>{{ vm.discount.name|default:discount_name }}: </span>
<span class="pull-right">- {{ discount.amount }} CHF</span>
</p>
{% endif %}
<p>

View file

@ -764,7 +764,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
context['vm']['price'] = price
context['vm']['discount'] = discount
context['vm']['vat_percent'] = vat_percent
context['vm']['total_price'] = price + vat - discount
context['vm']['total_price'] = price + vat - discount.amount
context['subscription_end_date'] = vm_detail.end_date()
except VMDetail.DoesNotExist:
try:
@ -784,7 +784,8 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
context['vm']['price'] = price
context['vm']['discount'] = discount
context['vm']['vat_percent'] = vat_percent
context['vm']['total_price'] = price + vat - discount
context['vm']['total_price'] = price + \
vat - discount.amount
except WrongIdError:
messages.error(
self.request,
@ -1084,7 +1085,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View):
'price': price,
'vat': vat,
'vat_percent': vat_percent,
'total_price': price + vat - discount,
'total_price': price + vat - discount.amount,
'pricing_name': vm_pricing_name
}