title: This page isn’t working right nowIf the problem continues, contact the site owner. HTTP ERROR 405 trying to fix this problem in django?
body: <p><strong>When I click on delete button, I am getting an error: This page isn’t working right now the problem continues, contact the site owner. HTTP ERROR 405</strong></p>
  <p><strong>This is mine view.py file:</strong></p>
  <pre><code>from django.shortcuts import render,get_object_or_404
  from django.http import HttpResponse
  from django.views.generic import ListView,DetailView, CreateView, UpdateView, DeleteView  
  from .models import Post, TaskCategory
  from .forms import PostForm
  from django.urls import reverse_lazy
  
  class DeletePostView(DetailView):
        model = Post
        template_name = 'delete_post.html'
        success_url = reverse_lazy('PostPage')
  </code></pre>
  <p><strong>urls.py file:</strong></p>
  <pre><code>from django.urls import path
  # from . import views
  from .views import PostHomeView,PostDetail,NavFooter,PostPageView,AddPost,UpdatePost,DeletePostView
  
  urlpatterns = [
  path('', PostHomeView.as_view(), name ='home'),
  path('PostDetail/&lt;int:pk&gt;', PostDetail.as_view(), name ='post_detail'),
  path('PostPage/', PostPageView, name ='post_page'),
  path('AddPost/', AddPost.as_view(), name = 'add_post'),
  path('PostDetail/UpdatePost/&lt;int:pk&gt;', UpdatePost.as_view(), name = 'update'),
  path('DeletePost/&lt;int:pk&gt;/', DeletePostView.as_view(), name = 'delete'),
  ]
  </code></pre>
  <p><strong>HTML delete_page.html file:</strong></p>
  <pre><code>{% extends &quot;nav_footer.html&quot; %}
  {% load static %}
  {% block content %}
  
  &lt;div class=&quot;form-group&quot;&gt;
     &lt;p&gt;{{ post.task_title }}&lt;/p&gt;
     &lt;p&gt;{{ post.task_discription }}&lt;/p&gt;
     &lt;p&gt;{{ post.recommended_tools }}&lt;/p&gt;
     &lt;p&gt;{{ post.budget }}&lt;/p&gt;
     &lt;form method=&quot;post&quot;&gt;
       {% csrf_token %}
       &lt;button class=&quot;btn btn-secondary&quot;&gt;Delete&lt;/button&gt;
     &lt;/form&gt;
   &lt;/div&gt;
   {% endblock %}
  </code></pre>
  <p><strong>And this is modes.py</strong></p>
  <pre><code>from django.contrib.auth.models import User
  from django.db import models
  from django.urls import reverse
  
  class TaskCategory(models.Model):
      category_title = models.CharField(max_length=50)
  
      def __str__(self):
          return self.category_title
  
   class Post(models.Model):
       task_title = models.CharField(max_length=250)
       task_discription = models.CharField(max_length=250)
       task_category = models.ForeignKey(TaskCategory, on_delete=models.CASCADE)
       recommended_tools = models.CharField(max_length=250)
       budget = models.IntegerField(default=0)
  
       def __str__(self):
          return self.task_title + ' | ' + self.task_discription + ' | ' + str(self.task_category) + ' | ' + self.recommended_tools + ' | ' + str(self.budget) + ' | ' + str(self.id)
  
  def get_absolute_url(self):
      return reverse('post_detail', args=[str(self.id)])
  </code></pre>
  <p><strong>I think the problem is somewhere revers_lazy function, I am not sure about that</strong></p>