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})
精彩评论