Open DietkeSt opened 2 months ago
It turns out, it was just an additional , that caused the issue, correcting the view to the following fixed the issue:
def product_detail(request, slug): product = get_object_or_404(Product, slug=slug, in_stock=True) average_rating = round(product.average_rating) number_range = range(1, 101) return render(request, 'products/detail.html', { 'product': product, 'average_rating': average_rating, 'range': range(5), 'number_range': number_range })
When I visit the product detail page, I should select a number of items for the services I want to order. But it currently does not show any number with this setup:
View:
def product_detail(request, slug): product = get_object_or_404(Product, slug=slug, in_stock=True) average_rating = round(product.average_rating) number_range = range(1, 101) return render(request, 'products/detail.html', { 'product': product, 'average_rating': average_rating, 'range': range(5), 'number_range': number_range, })