0
我试图在名为blogpage的模板中使用两个视图列表(post_list和classification_list)。这是我已经做了解决问题,但它没有工作:如何在一个模板中合并x视图
class GenViewList(ListView):
model = Posting,Classification
template_name = 'Blog/blogpage.html'
def get_context_data(self, **kwargs):
context=super(BlogViewList,self).get_context_data(**kwargs)
context['latest_post_list']=Posting.objects.filter().order_by('-id')[:30]
context['classification_list']=Classification.objects.all().order_by('id')
return context
任何帮助将不胜感激!
非常感谢,它的工作 –