add related articles to detail views

This commit is contained in:
Tobias Brunner 2025-06-06 15:22:02 +02:00
parent b456816035
commit 18e9156683
No known key found for this signature in database
8 changed files with 140 additions and 0 deletions

View file

@ -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)