首页 > 解决方案 > django 模板的 for 循环内容未显示

问题描述

return render(request, "auctions/close.html",{
"winners":Bid.objects.all()
        })

这是在我看来.py ..

{% extends "auctions/layout.html" %}
{% block body %}

The winner for this item is

{% for winner in winners %}

<h2>{{winner.user}}</h2>

{% endfor %}
{% endblock %}

这是 close.html 模板。但是这里的for循环不起作用....谁能告诉我这里出了什么问题...

标签: pythonfor-loopdjango-modelsdjango-viewsdjango-templates

解决方案


推荐阅读