diff --git a/shop/views.py b/shop/views.py index 38a335c9..e6b4c4af 100644 --- a/shop/views.py +++ b/shop/views.py @@ -90,7 +90,11 @@ class ShopIndexView(ListView): if 'category' in self.request.GET: category = self.request.GET.get('category') - if not category.public: + try: + categoryobj = ProductCategory.objects.get(slug='category') + if not categoryobj.public: + raise Http404("Category not found") + except ProductCategory.DoesNotExist: raise Http404("Category not found") context['products'] = context['products'].filter( category__slug=category,