django deleteview class

Solutions on MaxInterview for django deleteview class by the best coders in the world

showing results for - "django deleteview class"
Eoin
05 May 2020
1##### views.py #####
2from django.urls import reverse_lazy
3from django.views.generic.edit import DeleteView
4from myapp.models import Author
5
6class AuthorDelete(DeleteView):
7    model = Author
8    success_url = reverse_lazy('author-list')
9    
10##### author_confirm_delete.html #####
11<form method="post">{% csrf_token %}
12    <p>Are you sure you want to delete "{{ object }}"?</p>
13    <input type="submit" value="Confirm">
14</form>