Reverse for 'delete_post' with arguments '('',)' not found. 1 pattern(s) tried: ['article/(?P<pk>[0-9]+)/remove$']

i was creating a simple blog site and I created buttons to delete7edit , but as soon as I try to reset the app and go there I get this error ( title )

this is my code view.py:

from django.views.generic import ListView
from . models import Article
from django.views.generic import ListView, DetailView, CreateView, UpdateView, 
DeleteView
from .forms import PostForm, EditForm
from django.urls import reverse_lazy



class ArticleListView(ListView):
    model = Article
    template_name = 'home.html'


class ArticleDetailView(DetailView):
    model = Article
    template_name = 'detail.html'


class AddPostView(CreateView):
    model = Article
    form_class = PostForm
    template_name = 'add_post.html'
    #fields = '__all__'
    #fields = ('title', 'body')


class UpdatePostView(UpdateView):
    model = Article
    form_class = EditForm
    template_name = 'update_post.html'
    #fields = ['title', 'title_tag', 'body']


class DeletePostView(DeleteView):
    model = Article
    template_name = 'delete_post.html'
    success_url = reverse_lazy('home')

urls.py:

from django.urls import path
from . import views

urlpatterns = [
    path('', views.ArticleListView.as_view(), name='home'),
    path('article/<int:pk>', views.ArticleDetailView.as_view(), name='detail'),
    path('add_post/', views.AddPostView.as_view(), name='add_post'),
    path('article/edit/<int:pk>', views.UpdatePostView.as_view(), name='update_post'),
    path('article/<int:pk>/remove', views.DeletePostView.as_view(), name='delete_post'),
]

templates delete_post.html:

{% extends 'base.html' %}
{% block title %}Delete Blog Post{% endblock %}
{% block content %}


<h1>Delete Post...</h1>
<br/><br/>
<hr3>Delete: {{ post.title }}</hr3>

<br/>
<div class="mb-3">
    <form method="POST">{% csrf_token %}
        <strong>Are you sure?</strong><br/><br/>
         <button class="btn btn-secondary">Delete Post!</button>
</div>


{% endblock %}

templtes update_post.html:

{% extends 'base.html' %}
{% block title %}Edit Blog Post{% endblock %}
{% block content %}


<h1>Update Post...</h1>
<br/><br/>
<div class="mb-3">
    <form method="POST">{% csrf_token %}
        {{ form.as_p }}
        <button class="btn btn-secondary">Update</button>
</div>


{% endblock %}

help me please, I'm new on django and i don't know things yet -----------------------------------------------------------

Your delete url article/<int:pk>/remove but i saw you type article/1/ .

path('article/<int:pk>/remove', views.DeletePostView.as_view(), name='delete_post')

You need type article/1/remove.

Back to Top