开发者

How to use the querylist object in Django template

Initially i had this code

(r'^list/fixed/$', list_detail.object_list, fixedList)

In t开发者_如何学JAVAemplate i use

{% for val in object_list %}

It worked fine as i used Generic list

But now i want to write my own view which does same

 object_list = model.objects.all()
 return render_to_response('lists.html', object_list)

But its not working.

how can pass the same object list to template as in Generic View


render_to_response() takes a dictionary of variables to use.

return render_to_response('lists.html', {'object_list': object_list})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜