title: How to do a POST request in a DetailView
body: <p>im following a tutorial for the project but it does it on function views and im trying to do it on class based views</p>
  <p>i get a ( The view blog.views.PostDetailView didn't return an HttpResponse object. It returned None instead.) error but thats not my concern now ... because the data(new comments) arent getting saved
  so how can i save them with the post request and redirect to the same page of the DetailView</p>
  <p>my urls</p>
  <pre><code>app_name = 'blog'
  
  urlpatterns = [
      path('', views.PostListView.as_view(), name='blog-home'),
      path('blog/&lt;slug:slug&gt;/', views.PostDetailView.as_view() , name='post-detail'),
      ]
  </code></pre>
  <p>my models</p>
  <pre><code>class Post(models.Model):
  
      options = (
          ('draft', 'Draft'),
          ('published', 'Published')
      )
  
      title = models.CharField(max_length=250)
      slug =  models.SlugField(max_length=250, unique_for_date='publish_date')
      publish_date = models.DateTimeField(default=timezone.now)
      author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='blog_posts')
      content = models.TextField()
      status = models.CharField(max_length=10, choices=options, default='draft')
  
      class Meta:
          ordering = ('-publish_date',)
  
      def __str__(self):
          return self.title
  
      def get_absolute_url(self):
          return reverse('post-detail', kwargs={'slug': self.slug})
  </code></pre>
  <pre><code>class Comment(models.Model):
      post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments')
      author = models.ForeignKey(User, on_delete=models.CASCADE)
      content = models.TextField()
      publish_date = models.DateTimeField(auto_now_add=True)
  
      class Meta:
          ordering = ('-publish_date',)
  
      def __str__(self):
          return f'Comment By {self.author}/{self.post}'
  </code></pre>
  <p>my forms</p>
  <pre><code>class AddCommentForm(forms.ModelForm):
      content = forms.CharField(label =&quot;&quot;, widget = forms.Textarea( 
      attrs ={ 
          'class':'form-control', 
          'placeholder':'Comment here !', 
          'rows':4, 
          'cols':50
      })) 
  
      class Meta: 
          model = Comment 
          fields =['content']
  
  </code></pre>
  <p>my views</p>
  <pre><code>class PostDetailView( DetailView):
      model = Post
      context_object_name = 'post'
      template_name='blog/post_detail.html'
  
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          comments = Comment.objects.filter(post=self.object)
          context['comments'] = comments
          context['form'] = AddCommentForm()
          return context
  
      def post(self, request, *args, **kwargs):
          pass
  
      def form_valid(self, form):
          form.instance.author = self.post.author
          user_comment.post = self.post
          user_comment.save()
          return super().form_valid(form)
  
  </code></pre>
  <p>html</p>
  <pre><code>            &lt;form method=&quot;POST&quot;&gt;
                &lt;div class=&quot;col-12&quot;&gt;
                  &lt;hr&gt;
                  {% with comments.count as total_comments %}
                    &lt;legend class=&quot;border-bottom mb-4&quot;&gt;{{total_comments }} comment{{total_comments|pluralize }}&lt;/legend&gt;
                  {% endwith %}
                  {% for c in comments%}
                    &lt;div class =&quot;col-md-12 mb-1rem&quot; &gt;
                      &lt;p class=&quot;mb-0&quot;&gt;&lt;strong&gt;{{c.author}}:&lt;/strong&gt; {{c.content}}&lt;/p&gt;
                      &lt;small class=&quot;text-muted&quot;&gt;{{ c.publish_date|date:'f A, Y'}}&lt;/small&gt;
                    &lt;/div&gt;
                    &lt;br&gt;
                 {% endfor %}
                &lt;/div&gt;
                &lt;hr&gt;    
                {% csrf_token %}
                &lt;fieldset class=&quot;form-group&quot;&gt;
                    &lt;legend class=&quot;border-bottom mb-4&quot;&gt;New Comment&lt;/legend&gt;
                    {{ form|crispy }}
                &lt;/fieldset&gt;
                &lt;div class=&quot;form-group&quot;&gt;
                    &lt;button class=&quot;btn btn-dark btn-lg mt-1&quot; type=&quot;submit&quot;&gt;Publish&lt;/button&gt;
                &lt;/div&gt;
              &lt;/form&gt;
  
  </code></pre>