Hello guys, it's been a while here.
Need some help pls.
I had to override my ListView get_querryset() method to query my posts according to a given category. But it seem my context is not a list of objects again as I get this error message: "TypeError: unhashable type: 'slice' " when I try to add a paginate_by attribute to the view. Pls see my view below:
class CategoryListView(ListView):
template_name = 'blog/category.html'
context_object_name = 'cat_list'
paginate_by = 4
def get_queryset(self):
context = {
'cat': self.kwargs['category'],
'posts': Post.objects.filter(category__name=self.kwargs['category'], status='published')
}
return context
Any help will be appreciated as I don't seem to be strong with Django.