1👍
✅
You can override the .get_success_url()
method [Django-doc] to return the path to which we redirect:
from django.urls import reverse
class PatientAnalysisDeleteView(DeleteView):
model = PatientAnalysis
def get_success_url(self):
return reverse(
'journal:patient_analysis',
kwargs={'hist_num_slug': self.object.patient_id},
)
Source:stackexchange.com