写完修改文章的代码后,以前的文章不能点击跳转了……
Reverse for 'edit_page' with arguments '('',)' not found. 1 pattern(s) tried: ['blog/edit/(?P<article_id>[0-9]+)/$']
提示这个……
url:
from django.urls import path from . import views app_name = 'blog' urlpatterns = [ path('', views.index), path('article_page/<int:article_id>/', views.article_page, name='article_page'), path('edit/<int:article_id>/', views.edit_page, name='edit_page'), path('edit/action', views.edit_action, name='edit_action'), ]
报错页面底端提示的是article—page.html第12行有问题:
<html lang="en"> <head> <meta charset="UTF-8"> <title>Article_page</title> </head> <body> <h1>{{ article.title }}</h1> <br/> <h3>{{ article.content }}</h3> <br/><br/> <a href="{% url 'blog:edit_page' article_id %}"> 修改文章 </a> </body> </html>
也就是“="{% url 'blog:edit_page' article_id %}”这段是红色的……