我正在尝试从应用程序在网站主页上显示记录。在管理界面记录得到显示,但在网站主页上它不工作。你知道吗
场地结构
Site structure
website
--MyWebsite
----templates
--alert
----templates
警报代码/视图.py你知道吗
def weather_single(request):
weatheronly=Weatherreport.objects.last()
return render(request, '../MyWebsite/templates/sidebar_left.html', {'weatheronly':weatheronly})
MyWebsite/templates/sidebar上的代码_左.html你知道吗
{% for wresult in weatheronly %}
{{ wresult.temp }}
{{ wresult.forecast }}
{% endfor %}
url模式代码 urlpatterns=[网址('',views.weather\单,name='weather\u single'),]
Currently not getting any error message and no results at all.
你的考试有结果吗
weatheronly=Weatherreport.objects.last()
解决这个问题的最好方法是假设你的假设是不正确的,并检查原始数据中是否有任何数据。你知道吗
相关问题 更多 >
编程相关推荐