Ссылающийся Url работает со статическим числом, но не с переменным

Так я пытаюсь заставить product_id работать, и каждый раз возникает эта ошибка:NoReverseMatch at /playground/hello/ Reverse for 'information' with arguments '('',)' not found. 1 pattern(s) tried: ['playground/hello/(?P<product_id>[0-9]+)\Z']

Отлично работает, если вместо product_id в файле index.html передать константу типа числа 1 или 2 (можно бесконечно долго, исходя из того, сколько объектов хранится в админпанели), но проблема в том, что если я нажимаю на любую ссылку на первой странице, она перенаправляет на одну и ту же, независимо от того, что я нажимаю.

index.html

{% extends 'base.html' %}

{% block content %}
    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>Work</th>
                <th>Type of Work</th>
                <th>Hours needed</th>
            </tr>
        </thead>
        <tbody>
            {% for context2 in context%}
                <tr>
                    <td>
                        <a href={% url 'product:information' product_id %}>{{context2.work}}</a>
                        </td>
                    <td>{{context2.genre}}</td>
                    <td>{{context2.hoursWorked}}</td>
                </tr>
            {% endfor %}
        
        </tbody>
    
    </table>
{% endblock  %}

Urls.py

from django.urls import path
from . import views

app_name = 'product'
urlpatterns = [
    path('hello/', views.hello, name='hello'),
    path('hello/<int:product_id>', views.detail, name='information')
]

Views.py

from django.shortcuts import render, get_object_or_404                   
from django.http import Http404, HttpResponse
from .models import products, typeWork


def hello(request):
    context = typeWork.objects.all()
    context2 = {'context':context}
    return render(request, 'products/index.html', context2)

def detail(request, product_id):
    context = get_object_or_404(typeWork, id=product_id)
    context2 = {'context2':context}
    return render(request, 'products/detail.html', context2)
Вернуться на верх