title: Redirect to parent after deleting an object with DeleteObject generic view
body: <p>Let's say I have two models, Book and Page:</p>
  
  <pre><code>class Book(models.Model):
      pass
  
  class Page(models.Model):
      book = models.ForeignKey(Book)
  </code></pre>
  
  <p>I need to delete a page and being redirected to the specific book that the page belonged to. To achieve this, I make a class based view to delete the page:</p>
  
  <pre><code>class PageDeleteView(DeleteView):
      model = Page
  
      def get_success_url(self, **kwargs):
          return reverse_lazy('book_detail', self.book.pk)
  </code></pre>
  
  <p>The problem is that, since the object is deleted before get_success_url is called, this method fails, and I get a 404 error.</p>
  
  <p>How could I do it?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Following the idea of @DrTyrsa, I have achieved it overriding the delete method, so the class would be as follows:</p>
  
  <pre><code>reverse_lazy = lambda name=None, *args : lazy(reverse, str)(name, args=args)
  
  class PageDeleteView(DeleteView):
      model = Page
  
      def get_success_url(self, **kwargs):
          return reverse_lazy('book_detail', self.book.pk)
  
      def delete(self, request, *args, **kwargs):
          self.book_pk = self.get_object().book.pk
          return super(PageDeleteView, self).delete(request, *args, **kwargs)
  </code></pre>