template_name_suffix
The DeleteView
page displayed to a GET
request uses a template_name_suffix
of '_confirm_delete'
. For example, changing this attribute to '_check_delete'
for a view deleting objects for the example Author
model would cause the default template_name
to be 'myapp/author_check_delete.html'
.
Example myapp/views.py:
1 2 3 4 5 6 7 | from django.views.generic.edit import DeleteView from django.urls import reverse_lazy from myapp.models import Author class AuthorDelete(DeleteView): model = Author success_url = reverse_lazy( 'author-list' ) |
Example myapp/author_confirm_delete.html:
1 2 3 4 | < form action = "" method = "post" >{% csrf_token %} < p >Are you sure you want to delete "{{ object }}"?</ p > < input type = "submit" value = "Confirm" /> </ form > |
Please login to continue.