Я застреваю, передавая идентификатор в шаблон. Вот мой файл views.py
def add_academy(request,pk):
child=get_object_or_404(Child_detail,pk=pk)
academy=Academic.objects.filter(Student_name=child)
context={
'academy':academy,
}
return render(request,'functionality/more/academy/add.html',context)
Также этот мой файл urls.py
from . import views
from django.urls import path
urlpatterns=[
path('add_academy/<int:pk>/',views.add_academy, name='add_academy')
]
А это мой шаблон
<div class="container">
<td><a href="{% url 'add_academy' child.id %}">
<button type="button" class="btn btn-primary">Add Academic details of a child</button>
</a>
</td>
Он показывает мне ошибка, которая гласит, что
NoReverseMatch at /academy/add_academy/3/
Reverse for 'academy' not found. 'academy' is not a valid view function or pattern name.
Request Method: GET
Request URL: http://127.0.0.1:8000/academy/add_academy/3/