How do I return the url back to details page once the comment is deleted – Django?

So at the moment once the comment is deleted, the URL takes back to the post list page. As probably you could tell that I am not very experienced with Django yet so if someone could explain that how do I figure out what key is to be passed and where, that would be a great help.
Please find the codes below:


class Post(models.Model):

    CHOICES = (
        ('celebrate', 'celebrate'),
        ('planning', 'planning'),
        ('outdoor', 'outdoor'),
        ('holidays', 'holidays'),
        ('festivals', 'festivals'),
        ('movies', 'movies'),
        ('shopping', 'shopping'),
        ('laptop', 'laptop'),
        ('data', 'data'),
        ('sciance', 'science'),
        ('summers', 'summers'),
        ('medical', 'medical'),
        ('art', 'art'),


    author = models.ForeignKey(User, on_delete=models.CASCADE,
    title = models.CharField(max_length=200)
    date_posted = models.DateTimeField(
    text = models.TextField()
    category = models.CharField(max_length=100,
                                null=True, choices=CHOICES)
    tags = models.ManyToManyField(Tag)

    class Meta:
        """ Meta class to change the configuration,
        ordering by the name"""
        ordering = ['-date_posted']

    def get_absolute_url(self):
        """ Reverse the Post object to the url once action
        has been taken with primary key to direct back to the
        same post """
        return reverse('posts:post_list')

    def __str__(self):
        return self.title

class Comment(models.Model):
    """ comments for Post model  """

    comment_post = models.ForeignKey(Post, on_delete=models.CASCADE,
                                     related_name='comment_for_post', null=True, default='')
    comment_text = models.TextField(null=True)
    date_posted = models.DateTimeField(auto_now=True)

    def get_absolute_url(self):
        """ Reverse the Post object to the url once action
        has been taken with primary key to direct back to the
        same post """
        return reverse('posts:post_details', kwargs={'pk':})

    def __str__(self):
        return self.comment_text


def add_comment_to_post(request, pk):
    """ To attach comments to the post"""
    post = get_object_or_404(models.Post, pk=pk)

    if request.method == 'POST':
        form = forms.CommentForm(request.POST)

        if form.is_valid():
            comment =
            comment.comment_post = post
            return redirect('posts:post_details',

        form = forms.CommentForm()

    return render(request, 'posts/comment_form.html', context={'form': form})

class CommentDeleteView(LoginRequiredMixin, generic.DeleteView):
    model = models.Comment
    template_name = 'posts/comment_confirm_delete.html'

    def delete(self, *args, **kwargs):
        self.object = self.get_object()
        super().delete(*args, **kwargs)

    def get_success_url(self):
        return reverse_lazy('posts:post_list')


urlpatterns = [
    path('post_list/', views.PostListView.as_view(), name='post_list'),
    path('user/<str:username>/', views.UserPostListView.as_view(), name='user_posts'),
    path('create/', views.PostCreateView.as_view(), name='create'),
    path('details/<int:pk>/', views.PostDetailView.as_view(), name='post_details'),
    path('delete/<int:pk>/', views.PostDeleteView.as_view(), name='post_delete'),
    path('update/<int:pk>/', views.PostUpdateView.as_view(), name='post_update'),
    path('<str:category>/', views.CategoryPostListView.as_view(),
    path('posts/<int:pk>/comment', views.add_comment_to_post,
         views.CommentDeleteView.as_view(), name='delete_comment'),




    <div class='container'>
      {% for comment in post.comment_for_post.all %}
      {% if == user %}
      <div class="comment-post">
                  <p >{{comment.comment_text|safe}},  <span><a href="{#}"> Reply</a></span></p>
                  <p>From {{user.username}} on {{comment.date_posted|date:'d-M-y'}},

                      <span><a href="{% url 'posts:delete_comment' %}">Delete comment?</a></span>


          {%else %}
          <div class="comment-post">
                  <p >{{comment.comment_text|safe}},  <span><a href="{#}"> Reply</a></span></p> </p>
                  <p>From {{user.username}} on {{comment.date_posted|date:'d-M-y'}},



def get_success_url(self):
    return reverse_lazy('posts:post_details', kwargs={'pk':})