diff --git a/shop/templates/shop_index.html b/shop/templates/shop_index.html
index fc0c8ad7..1a3fb9fa 100644
--- a/shop/templates/shop_index.html
+++ b/shop/templates/shop_index.html
@@ -49,7 +49,7 @@ Shop | {{ block.super }}
{% endifchanged %}
-
+
{{ product.name }}
@@ -61,6 +61,12 @@ Shop | {{ block.super }}
|
+ {% empty %}
+
+
+ Sorry no products found.
+ |
+
{% endfor %}
diff --git a/shop/views.py b/shop/views.py
index 35f089cb..a6fe061a 100644
--- a/shop/views.py
+++ b/shop/views.py
@@ -171,7 +171,7 @@ class ShopIndexView(ListView):
def get_queryset(self):
queryset = super(ShopIndexView, self).get_queryset()
- return queryset.order_by('category__name', 'price', 'name')
+ return queryset.available().order_by('category__name', 'price', 'name')
def get_context_data(self, **kwargs):
context = super(ShopIndexView, self).get_context_data(**kwargs)
@@ -197,6 +197,7 @@ class ShopIndexView(ListView):
).filter(
num_products__gt=0,
public=True,
+ products__available_in__contains=timezone.now()
)
return context