DeleteView and success_url
Confirm deletions and redirect afterward.
Removing Records Safely
Sometimes data has to go. DeleteView handles removing a record, with a confirmation step built in. 🗑️
Meet DeleteView
DeleteView loads one object by its pk and prepares to delete it once the user confirms.
from django.views.generic import DeleteView
class PostDelete(DeleteView):
model = PostAll lessons in this course
- ListView and DetailView
- CreateView and UpdateView
- DeleteView and success_url
- Overriding get_queryset and Templates