私のblog-project in djangoでは、category.htmlのようなページにすべてのカテゴリを表示したいのですが、カテゴリのリンクをクリックすると、カテゴリ:このように:http:xxx/category
私はすべてのカテゴリを表示し、http:xxx/category/django
すべてのdjangoのarticalを表示django web-projectカテゴリ
どのようにするには?
class CategoryView(ListView):
template_name = "index.html"
context_object_name = "article_list"
def get_queryset(self):
article_list = Post.objects.filter(category=self.kwargs['id'])
return article_list
def get_context_data(self, **kwargs):
kwargs['category_list'] = Category.objects.all().order_by('cate_name')
return super(CategoryView, self).get_context_data(**kwargs)