Skip the QuerySet in the template. Django

How to pass a QuerySet object to a template. And then iterate through it in tempalte. If ikan does this ...?

Example

queryset =MyModel.objects.all() return render_to_response('template.html',{'queryset':queryset}) 

How will it look in the template?

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

+4
source share
1 answer
 {% for each_model in model %} #Do Something with model {{each_model.name}} {% endfor %} 
+4
source

Source: https://habr.com/ru/post/1316303/


All Articles