feat: added seo template and prioduct.slug
This commit is contained in:
+9
-1
@@ -9,6 +9,11 @@ from shop.models import Product
|
||||
class IndexView(TemplateView):
|
||||
template_name = "shop/index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return {
|
||||
"title": "Shoppy",
|
||||
}
|
||||
|
||||
|
||||
class ListProducts(TemplateView, FilteredQuerysetMixin, PaginatedQuerysetMixin):
|
||||
template_name = "shop/list_products.html"
|
||||
@@ -27,11 +32,14 @@ class ListProducts(TemplateView, FilteredQuerysetMixin, PaginatedQuerysetMixin):
|
||||
class ProductDetail(TemplateView):
|
||||
template_name = "shop/product_detail.html"
|
||||
|
||||
def get_context_data(self, pk, **kwargs):
|
||||
def get_context_data(self, pk, slug, **kwargs):
|
||||
product = get_object_or_404(Product, pk=pk)
|
||||
|
||||
return {
|
||||
"product": product,
|
||||
"title": product.name,
|
||||
"description": product.description,
|
||||
"image": product.images.first(),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user