Не работает создание комментариев под постом в Django

Пишет HTTP ERROR 405
Не могу понять в чем ошибка
Буду благодарен кто поможет
Вот код: Views.py

class BlogDetail(FormMixin, DetailView):
    template_name = 'blog-details.html'
    model = BlogModel
    form_class = ClientForm
    context_object_name = 'i'
    success_url = reverse_lazy('blog')
    extra_context = {'inf': info}

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['comments'] = Comments.objects.all()
        context['create'] = CommentForm
        context['categories'] = Category.objects.all()
        context['posts'] = BlogModel.objects.all()
        context['three'] = BlogModel.objects.all()[:3]
        context['count'] = len(tuple(Comments.objects.filter(post=self.get_object())))
        context['data'] = info

        return context

models.py:

from django.db import models


# Create your models here.
class ClientModel(models.Model):
    fname = models.CharField("First name", max_length=50)
    lname = models.CharField("Last name", max_length=50)
    email = models.EmailField("Email", max_length=254)
    sub = models.CharField("Subject", max_length=254)
    msg = models.TextField("Message")

    def __str__(self):
        return self.email


class Category(models.Model):
    category = models.CharField("Category", max_length=100)

    def __str__(self):
        return self.category


class Author(models.Model):
    fullname = models.CharField("Fullname", max_length=150)
    pic = models.ImageField(upload_to='authors/')
    mail = models.EmailField('Email', max_length=200)

    def __str__(self):
        return self.fullname


class BlogModel(models.Model):
    title = models.CharField("Title", max_length=300)
    content = models.TextField("Content")
    created = models.DateTimeField(auto_now_add=True)
    pic = models.ImageField(upload_to='post_img/')
    category = models.ForeignKey(Category, on_delete=models.PROTECT)
    author = models.ForeignKey(Author, on_delete=models.PROTECT)

    def __str__(self):
        return self.title

class Comments(models.Model):
    post = models.ForeignKey(BlogModel, related_name='comments', on_delete=models.CASCADE, default=1)
    name = models.CharField('Name', max_length=80)
    body = models.TextField('Comment')
    created = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ('created',)
        verbose_name = 'Comment'
        verbose_name_plural = 'Comments'

    def __str__(self):
        return 'Comment by {} in post {}'.format(self.name, self.post)

form.py:

from django import forms
from .models import *


class ClientForm(forms.ModelForm):
    class Meta:
        model = ClientModel
        fields = '__all__'
        widgets = {
            'fname': forms.TextInput(
                attrs={
                    'id': 'fname',
                    'class': 'form-control',
                }
            ),
            'lname': forms.TextInput(
                attrs={
                    'id': 'lname',
                    'class': 'form-control',
                }
            ),
            'email': forms.EmailInput(
                attrs={
                    'id': 'email',
                    'class': 'form-control',
                }
            ),
            'sub': forms.TextInput(
                attrs={
                    'id': 'subject',
                    'class': 'form-control',
                }
            ),
            'msg': forms.Textarea(
                attrs={
                    'id': "message",
                    'cols': 30,
                    'rows': 5,
                    'class': 'form-control',
                    'placeholder': "Write your notes or questions here...",
                }
            )
        }

class CommentForm(forms.ModelForm):
    class Meta:
        model = Comments
        fields = ('name', 'body')
        widgets = {
            'name': forms.TextInput(
                attrs={
                    'id': 'name',
                    'class': 'form-control',
                    'placeholder': "Your name:",
                }
            ),
            'body': forms.Textarea(
                attrs={
                    'id': "message",
                    'cols': 30,
                    'rows': 5,
                    'class': 'form-control',
                    'placeholder': "Write your comment here...",
                }
            )
        }

html:

{% extends 'base.html' %}
{% load static %}
{% block content %}

  <div class="page-section pt-5">
    <div class="container">
      <nav aria-label="Breadcrumb">
        <ul class="breadcrumb p-0 mb-0 bg-transparent">
          <li class="breadcrumb-item"><a href="index.html">Home</a></li>
          <li class="breadcrumb-item"><a href="blog.html">Blog</a></li>
          <li class="breadcrumb-item active">{{i.title}}</li>
        </ul>
      </nav>

      <div class="row">
        <div class="col-lg-8">
          <div class="blog-single-wrap">
            <div class="header">
              <div class="post-thumb" style="
                background-image: url({{i.pic.url}});
                background-size: cover;
                background-position: center;
                background-repeat: no-repeat;">
              </div>
              <div class="meta-header">
                <div class="post-author">
                  <div class="avatar">
                    <img src="{{i.author.pic.url}}" alt="">
                  </div>
                  by <a href="#">{{i.author.fullname}}</a>
                </div>

                <div class="post-sharer">
                  <a href="#" class="btn social-facebook"><span class="mai-logo-facebook-f"></span></a>
                  <a href="#" class="btn social-twitter"><span class="mai-logo-twitter"></span></a>
                  <a href="#" class="btn social-linkedin"><span class="mai-logo-linkedin"></span></a>
                  <a href="#" class="btn"><span class="mai-mail"></span></a>
                </div>
              </div>
            </div>
            <h1 class="post-title">{{i.title}}</h1>
            <div class="post-meta">
              <div class="post-date">
                <span class="icon">
                  <span class="mai-time-outline"></span>
                </span> <a href="#">{{i.created|date:"M d, Y"}}</a>
              </div>
              <div class="post-comment-count ml-2">
                <span class="icon">
                  <span class="mai-chatbubbles-outline"></span>
                </span>
                  <a href="#">
                      {% if count != 0%}
                          0 comments
                      {% else %}
                          {{ count }} comments
                      {% endif %}
                  </a>
              </div>
            </div>
            <div class="post-content">
             {{i.content|safe}}
            </div>
          </div>

          <div class="comment-form-wrap pt-5">
            <h2 class="mb-5">Write a comment</h2>
            <form class="" method="post">
              {% csrf_token %}
              <div class="form-row form-group">
                <div class="col-md-12">
                  {{create.name}}
                </div>
              </div>
              <div class="form-group">
                {{create.body}}
              </div>
                <input type="submit" value="Post Comment" class="btn btn-primary">
            </form>
          </div>

            {% if count != 0 %}
                <div class="comment-form-wrap pt-5">
                    <h2 class="mb-5">Comments:</h2>
                    {% for comment in comments %}
                        <h5 class="comment__name">{{ comment.name }}:</h5>
                        <p class="comment__text" style="margin-left: 90px">{{ comment.body }}</p>
                    {% endfor %}

                </div>
            {% endif %}

        </div>
        <div class="col-lg-4">
          <div class="widget">
            <!-- Widget search -->
            <div class="widget-box">
              <form class="search-widget" method="get">
                <input type="text" class="form-control" placeholder="Enter keyword..">
                <button type="submit" class="btn btn-primary btn-block">Search</button>
              </form>
            </div>

            <!-- Widget Categories -->
            <div class="widget-box">
              <h4 class="widget-title">Category</h4>
              <div class="divider"></div>

              <ul class="categories">
                {% for category in categories %}
                    <li><a href="#">{{ category }}</a></li>
                {% endfor %}
              </ul>
            </div>

            <!-- Widget recent post -->
            <div class="widget-box">
              <h4 class="widget-title">Recent Post</h4>
              <div class="divider"></div>

            <div class="cont" style="">
                  {% for i in three %}
                <div class="blog-item">
                    <a class="post-thumb" href="">
                    <img src="{{ i.pic.url }}" alt="">
                  </a>
                  <div class="content">
                    <h6 class="post-title"><a href="{% url 'blog_detail' i.pk %}">{{ i.title }}</a></h6>
                    <div class="meta">
                      <a href="#"><span class="mai-calendar"></span>{{ i.created }}</a>
                      <a href="#"><span class="mai-person"></span>{{ i.author }}</a>
                      <a href="#"><span class="mai-chatbubbles"></span>{{ i.comments }}</a>
                    </div>
                  </div>
                </div>
                  {% endfor %}
            </div>
            <!-- Widget Tag Cloud -->
            <div class="widget-box">
              <h4 class="widget-title">Tag Cloud</h4>
              <div class="divider"></div>

              <div class="tag-clouds">
                <a href="#" class="tag-cloud-link">Projects</a>
                <a href="#" class="tag-cloud-link">Design</a>
                <a href="#" class="tag-cloud-link">Travel</a>
                <a href="#" class="tag-cloud-link">Brand</a>
                <a href="#" class="tag-cloud-link">Trending</a>
                <a href="#" class="tag-cloud-link">Knowledge</a>
                <a href="#" class="tag-cloud-link">Food</a>
              </div>
            </div>

          </div>
        </div>
      </div>

    </div>
  </div>
  </div>

{% endblock content %}
Вернуться на верх