class CatalogueView(TemplateView):
"""
Browse all products in the catalogue
"""
context_object_name = "products"
template_name = 'oscar/catalogue/browse.html'
def get(self, request, *args, **kwargs):
try:
self.search_handler = self.get_search_handler(
self.request.GET, request.get_full_path(), [])
except InvalidPage:
# Redirect to page one.
messages.error(request, _('The given page number was invalid.'))
return redirect('catalogue:index')
return super().get(request, *args, **kwargs)
def get_search_handler(self, *args, **kwargs):
return get_product_search_handler_class()(*args, **kwargs)
def get_context_data(self, **kwargs):
ctx = {}
ctx['summary'] = _("All products")
search_context = self.search_handler.get_search_context_data(
self.context_object_name)
ctx.update(search_context)
return ctx
def get_context_data(self, *args, **kwargs): # <--- method already defined (function-redefined)
context = super(CatalogueView, self).get_context_data(*args, **kwargs)
context['slides'] = SliderImage.objects.order_by("-created_on")
return context