add related articles to detail views
This commit is contained in:
parent
b456816035
commit
18e9156683
8 changed files with 140 additions and 0 deletions
|
@ -129,10 +129,20 @@ def offering_detail(request, provider_slug, service_slug):
|
|||
except VSHNAppCatPrice.DoesNotExist:
|
||||
pass
|
||||
|
||||
# Get related articles for both cloud provider and service
|
||||
provider_articles = offering.cloud_provider.articles.filter(
|
||||
is_published=True
|
||||
).order_by("-created_at")[:3]
|
||||
service_articles = offering.service.articles.filter(is_published=True).order_by(
|
||||
"-created_at"
|
||||
)[:3]
|
||||
|
||||
context = {
|
||||
"offering": offering,
|
||||
"pricing_data_by_group_and_service_level": pricing_data_by_group_and_service_level,
|
||||
"price_calculator_enabled": price_calculator_enabled,
|
||||
"provider_articles": provider_articles,
|
||||
"service_articles": service_articles,
|
||||
}
|
||||
return render(request, "services/offering_detail.html", context)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue