【发布时间】:2020-03-26 18:29:39
【问题描述】:
在 Django 中,当我单击返回 id 但页面未显示返回的链接时。
这是网址,
url(r'^(?P<pk>[-\w]+)/$', views.SchoolDetailView.as_view(),name = 'detail')
查看.py
class SchoolDetailView(DetailView):
context_object_name = 'school_detail'
model = models.School
template_name = 'basic_app/school_detail.html'
HTML 视图
{% for school in schools %}
<h2><li><a href="{{school.id}}">{{school.name}}</a></li></h2>
{% endfor %}
【问题讨论】:
标签: django