当我添加网址时显示此错误
{% for prgmm in programinfo.all %}
<a href="{% url 'program' prgm.id %}">
<div id="prgmm" style="width:50%">
<img src="{{ prgmm.titleimage.url }}" alt="">
</div>
</a>
我的网址是:
urlpatterns = [
path('', views.homepage, name='home'),
path('<int:services_id>/', views.details, name='details'),
path('<int:prgm_id>/program/', views.program, name='program')
和我的观点:
def program(request, prgm_id):
programdetail = get_object_or_404(prgm, pk=prgm_id)
return render(request, 'program.html', {'programdetail': programdetail})
答案 0 :(得分:0)
将您的代码<a href="{% url 'program' prgm.id %}">
更改为<a href="{% url 'program' prgmm.id %}">
答案 1 :(得分:0)
您在网址部分写了“ prgm.id”而不是“ prgmm.id”