-
顯示給
GET
請求的DeleteView
頁麵使用template_name_suffix
的'_confirm_delete'
。例如,將此屬性更改為'_check_delete'
以刪除示例Author
模型的對象的視圖將導致默認template_name
為'myapp/author_check_delete.html'
。
本文介紹django.views.generic.edit.DeleteView.template_name_suffix
的用法。
聲明
template_name_suffix
示例 myapp/views.py:
from django.urls import reverse_lazy
from django.views.generic.edit import DeleteView
from myapp.models import Author
class AuthorDeleteView(DeleteView):
model = Author
success_url = reverse_lazy('author-list')
示例 myapp/author_confirm_delete.html:
<form method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p>
{{ form }}
<input type="submit" value="Confirm">
</form>
相關用法
- Python MongoDB Delete_one()用法及代碼示例
- Python MongoDB Delete_many()用法及代碼示例
- Python Decimal shift()用法及代碼示例
- Python Decimal rotate()用法及代碼示例
- Python Decimal max_mag()用法及代碼示例
- Python Decimal as_integer_ratio()用法及代碼示例
- Python Decimal is_subnormal()用法及代碼示例
- Python Decimal canonical()用法及代碼示例
- Python Decimal from_float()用法及代碼示例
- Python Decimal normalize()用法及代碼示例
- Python Decimal radix()用法及代碼示例
- Python Decimal copy_abs()用法及代碼示例
- Python Decimal is_finite()用法及代碼示例
- Python Decimal conjugate()用法及代碼示例
- Python Decimal min_mag()用法及代碼示例
- Python Decimal logical_invert()用法及代碼示例
- Python Django DetailView用法及代碼示例
- Python Decimal next_plus()用法及代碼示例
- Python Decimal轉String用法及代碼示例
- Python Decimal compare_total_mag()用法及代碼示例
- Python Decimal is_snan()用法及代碼示例
- Python Decimal to_integral_value()用法及代碼示例
- Python Decimal next_toward()用法及代碼示例
- Python Decimal as_tuple()用法及代碼示例
- Python Decimal max()用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.views.generic.edit.DeleteView.template_name_suffix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。