some settings
This commit is contained in:
parent
836187f2aa
commit
b0a76b88b4
5 changed files with 45 additions and 5 deletions
|
@ -2,7 +2,7 @@ from django.shortcuts import render
|
|||
from hub.services.models import ComputePlan, VSHNAppCatPrice, VSHNAppCatUnitRate
|
||||
|
||||
|
||||
def compute_plan_price_comparison(request):
|
||||
def pricelist(request):
|
||||
# Get all compute plans and app catalog prices
|
||||
compute_plans = (
|
||||
ComputePlan.objects.all()
|
||||
|
@ -11,7 +11,7 @@ def compute_plan_price_comparison(request):
|
|||
)
|
||||
appcat_prices = (
|
||||
VSHNAppCatPrice.objects.all()
|
||||
.select_related("service")
|
||||
.select_related("service", "discount_model")
|
||||
.prefetch_related("base_fees", "unit_rates")
|
||||
)
|
||||
|
||||
|
@ -55,6 +55,17 @@ def compute_plan_price_comparison(request):
|
|||
VSHNAppCatPrice.ServiceLevel.choices
|
||||
)[service_level]
|
||||
|
||||
# Include discount model information
|
||||
discount_info = None
|
||||
if (
|
||||
price_config.discount_model
|
||||
and price_config.discount_model.active
|
||||
):
|
||||
discount_info = {
|
||||
"name": price_config.discount_model.name,
|
||||
"description": price_config.discount_model.description,
|
||||
}
|
||||
|
||||
plan_data["calculated_prices"].append(
|
||||
{
|
||||
"service": price_config.service.name,
|
||||
|
@ -63,6 +74,9 @@ def compute_plan_price_comparison(request):
|
|||
"units": units,
|
||||
"currency": currency,
|
||||
"price": final_price,
|
||||
"plan_term": plan.get_term_display(),
|
||||
"service_term": price_config.get_term_display(),
|
||||
"discount_model": discount_info,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue