get category object
This commit is contained in:
parent
900bce6bc3
commit
42749bacd3
|
@ -90,7 +90,11 @@ class ShopIndexView(ListView):
|
||||||
|
|
||||||
if 'category' in self.request.GET:
|
if 'category' in self.request.GET:
|
||||||
category = self.request.GET.get('category')
|
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")
|
raise Http404("Category not found")
|
||||||
context['products'] = context['products'].filter(
|
context['products'] = context['products'].filter(
|
||||||
category__slug=category,
|
category__slug=category,
|
||||||
|
|
Loading…
Reference in a new issue