Привет всем, я хочу перейти на подробный вид, но я получаю эту ошибку при вставке URL
NoReverseMatch at /
Reverse for 'test' with no arguments not found. 1 pattern(s) tried: ['test/(?P<pk>[0-9]+)/$']
Вот мой Models.py
from django.db import models
# Create your models here.
class article(models.Model):
Title = models.CharField(max_length=200)
Content = models.CharField(max_length=1000)
Вот мой Views.py
from django.shortcuts import render
from django.views.generic import (ListView,DetailView)
from .models import *
# Create your views here.
class Article(ListView):
model = article
class Test(DetailView):
model = article
Вот мой Urls.py
from django.contrib import admin
from django.urls import path
from cbs import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.Article.as_view(),name="Article"),
path('test/<int:pk>/', views.Test.as_view(),name="test"),
]
Вот мой Article_list.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
{% for article in article_list %}
<h1><a href="{% url 'test' %}">{{ article.Title }}</a></h1>
{% endfor %}
</body>
</html>