如何解决ReverseNoMatch错误Django?

时间:2018-09-10 07:11:26

标签: python django url

urls.py

from django.urls import path
from . import views

app_name = 'infos'

urlpatterns = [
    path('', views.home_page, name='index_view'),
    path('members/', views.list_members, name='list_members'),
    path('members/<int:id>/', views.view_member, name='view_member'),
    path('members/<int:id>/photos/', views.show_photos, name='show_photos'),
]

views.py

def show_photos(request, id):

    member = BandMembers.objects.get(pk=id)
    member_id = member.pk
    print(member_id)
    photos = Photos.objects.get(band_member=member)
    return render(request, 'infos/photos.html', { 'photos': photos, 'member': member_id})

html模板photos.html

{%  extends 'base.html' %}
{% block title %}
    Στοιχεία
{% endblock %}

{% block body %}
    <div class="container">
        {{ form.as_p }}
        <a href="{% url 'infos:show_photos' id %}" class="btn btn-primary"> Φωτογραφίες </a>
    </div>
{% endblock %}

我收到一个NoReserveMatch错误。我究竟做错了什么?我一直在Stackoverflow,Youtube等处寻找时间,似乎我做得对。但是可以肯定,我不!!!!!!

我的错误在哪里?感谢大伙们 。

0 个答案:

没有答案