class SinglePostByCategory(DetailView): def get_queryset(self): return get_object_or_404(Post, category__slug=self.kwargs['category_slug'], slug=self.kwargs['post_slug'] )