DeleteView with a dynamic success_url dependent on id
This should work:
def get_success_url(self):
# Assuming there is a ForeignKey from Comment to Post in your model
post = self.object.post
return reverse_lazy( 'single_post', kwargs={'post.id': post.id})
Django's DeleteView
inherits from SingleObjectMixin
, which contains the get_object
method.