user_image
By  nature_liqin    On   2018年7月15日 22:15

刘老师,本章节第三小节的范例中,通过render(request, 'polls/index.html', context),context中对象实际上是一个QuerySet, 但是在html中,即使我的Question表中是有数据的,html中显示的永远是No polls are available. 我反复尝试,如果在view里for..in.. 传递是dict,html显示就没有问题。请问这是啥原因,研究两天了,我发现其他范例,传递的是对象,也是这种情况,请问是啥原因? 我的django版本是2.0.5, 谢谢