Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Display collections in navbar

Mira Szewczyk956a6e765009
diff --git a/saleor/product/models.py b/saleor/product/models.py
index e31c340a92..730815f507 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -388,3 +388,7 @@ class Collection(models.Model):
def __str__(self):
return self.name
+ def get_absolute_url(self):
+ return reverse('product:collection',
+ kwargs={'slug': self.slug,
+ 'collection_id': self.id})
diff --git a/saleor/product/urls.py b/saleor/product/urls.py
index 792a3322de..3cf96fccbc 100644
--- a/saleor/product/urls.py
+++ b/saleor/product/urls.py
@@ -10,4 +10,6 @@ urlpatterns = [
views.category_index, name='category'),
url(r'(?P<slug>[a-z0-9-_]+?)-(?P<product_id>[0-9]+)/add/$',
views.product_add_to_cart, name="add-to-cart"),
+ url(r'^collection/(?P<slug>[a-z0-9-_/]+?)-(?P<collection_id>[0-9]+)/$',
+ views.collection_index, name='collection'),
]
diff --git a/saleor/product/views.py b/saleor/product/views.py
index 80587a7db7..d71bce565a 100644
--- a/saleor/product/views.py
+++ b/saleor/product/views.py
@@ -12,6 +12,8 @@ from ..core.utils import get_paginator_items, serialize_decimal
from ..core.utils.filters import get_now_sorted_by
from .filters import ProductFilter, SORT_BY_FIELDS
from .models import Category
+from ..core.utils import get_paginator_items, serialize_decimal
+from .models import Category, Product
from .utils import (
get_availability, get_product_attributes_data, get_product_images,
get_variant_picker_data, handle_cart_form, product_json_ld,
diff --git a/templates/collection/index.html b/templates/collection/index.html
index f7e5884829..566549bdf8 100644
--- a/templates/collection/index.html
+++ b/templates/collection/index.html
@@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
- <title>$Title$</title>
+ <title>Title</title>
</head>
<body>
-$END$
+
</body>
</html>
\ No newline at end of file