开发者

Pass QuerySet object in template. Django

How can i pass QuerySet object in to template. And then Iterate through it in tempalte. If ican do it....?

Example

queryset =MyModel开发者_C百科.objects.all()

return render_to_response('template.html',{'queryset':queryset})

How it'll looks in template?

Can I show field of foreigne key object in this template?


{% for each_model in model %}
    #Do Something with model
    {{each_model.name}}
{% endfor %}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜