title: DeleteView lead to error 405 when submit is clicked on django
body: <p><strong>I have this small blog post app where everything works fine apart from delete view. As soon as I hit delete button I'm moved to my delete post page but when I hit confirm from DeleteView html page I get 405 error</strong></p>
  <p>My <code>views.py</code> for delete looks like this:</p>
  <pre class="lang-py prettyprint-override"><code>class DeletePost(DetailView):
      model = Articles
      template_name = 'delete_article.html'
      success_url = reverse_lazy('list_articles')
  
  </code></pre>
  <p>My html file where the link is mentioned is like this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  {% extends 'base.html' %}
  
  {% block body %}
  &lt;div class=&quot;container&quot;&gt;
  {% for i in articles %}
      &lt;div class=&quot;jumbotron&quot;&gt;
          &lt;h2&gt;{{i.title}}&lt;/h2&gt;
          &lt;p&gt;- {{i.author}}&lt;/p&gt;
          {{i.created_on}}
          {{i.updated_on}}
          &lt;p&gt;{{i.content}}&lt;/p&gt;
          &lt;a class=&quot;btn btn-warning&quot; href=&quot;{% url 'update_article' i.id %}&quot;&gt;Update&lt;/a&gt;
          &lt;a class=&quot;btn btn-danger&quot; href=&quot;{% url 'delete_article' i.id %}&quot;&gt;Delete&lt;/a&gt;
      &lt;/div&gt;
  {% endfor %}
  &lt;/div&gt;
  {% endblock %}   
  </code></pre>
  <p>urls.py looks this way:</p>
  <pre class="lang-py prettyprint-override"><code>from django.urls import path
  
  from mysite import views
  
  urlpatterns = [
      path('articles/', views.PostList.as_view(), name='list_articles'),
      path('articles/&lt;pk&gt;/', views.PostDetail.as_view(), name='detail_article'),
      path('create/new/', views.CreateNewPost.as_view(), name='create_new_article'),
      path('update/&lt;pk&gt;/', views.UpdatePost.as_view(), name='update_article'),
      path('delete/&lt;pk&gt;/', views.DeletePost.as_view(), name='delete_article'),
  ]
  </code></pre>
  <p>and html for DeleteView:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  {% extends 'base.html' %}
  
  {% block body %}
  &lt;form method=&quot;post&quot;&gt;
      {% csrf_token %}
      &lt;p&gt;Are you sure you want to delete &quot;{{ object }}&quot;?&lt;/p&gt;
      {{ form.as_p }}
      &lt;input class='btn btn-danger' type=&quot;submit&quot;  value=&quot;Confirm&quot;&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>