How to create a ModelForm instance with the child model record as a key to perform UpdateView on a modal form in DetailView

Thank you for pointing this out.

I tried changing the method option to GET, but as you can see in the image, only the markdown editor is displayed, but the comment to be edited is not displayed, and when I press the “Save Change” button, it does not redirect to the page specified in reverse_lazy().

<div class="modal fade bd-example-modal-lg" id="commentModal-{{ comment.pk }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                  <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">Modify Your Comment</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
                        <form class="text-center w-md-75 mx-auto" method="GET" enctype="multipart/form-data" action="{% url 'article:comment_update' comment.pk %}">
                          {% csrf_token %}
                          {{ form.non_field_errors }}
                          {{ form.media }}

                          {% for field in form %}                        
                          <div class="col-xl-12 form-group mb-4">
                            {{ field|markdown|safe }}
                            {{ field.errors }}
                          </div>
                          {% endfor %}
                        </form>
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-lg btn-primary py-3 px-4" data-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-lg btn-primary py-3 px-4">Save changes</button>
                      </div>
                    </div>
                  </div>
                </div>
class CommentUpdateView(generic.UpdateView, LoginRequiredMixin):
    model = Comment
    form_class = CommentCreateForm
    template_name = 'article_detail.html'

    def get_success_url(self):
        article = Article.objects.get(comment__pk=self.kwargs['pk'])
        return reverse_lazy('article:article_detail', kwargs={'pk': article.pk})

    def form_valid(self, form):
        messages.success(self.request, 'Your comment has been successfully updated.')
        return super().form_valid(form)

    def form_invalid(self, form):
        messages.error(self.request, 'Failed to correct comment.')
        return super().form_invalid(form)