title: How to create an object upon confirmation of deletion in DeleteView in Django
body: <p>In Django 3, I want to delete an object and upon the user confirming the deletion, create an unrelated object. The code I wrote below creates the unrelated object as soon as the user clicks &quot;delete&quot;, but before the user has confirmed the deletion. I want the unrelated object to be created upon confirmation of deletion.</p>
  <pre><code>class PromoteQuestionToMeta(DeleteView):
      model = QuestionList
      fields = []
  
      template_name = 'search/questionlist_confirm_delete.html'
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
  
          questionlist_object = self.object
          MetaQuestionList.objects.create(question=questionlist_object.question, created_by=questionlist_object.created_by)
  
          return context
  
      def get_success_url(self):
          return reverse_lazy('home:home')
  </code></pre>