【发布时间】:2022-01-15 00:09:33
【问题描述】:
我想问你,如果你知道,这里有一些要点或解决方案如何通过 Popup 引导窗口使用 DeleteView 类确认删除项目。所以我不会使用template_name,而是在当前页面弹出窗口。
非常感谢你所做的一切......!!!
更准确地说 我的 index.html 页面中有这个按钮
<button type="button" class=" ml-1 btn btn-outline-dark my-2 my-sm-0" data-toggle="modal" data-target="#exampleModal">
In
</button>
这里我有删除模式
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Are you sure to delete this?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div class="modal-footer">
<a href="#" class="button btn btn-primary">Yes</a>
<button type="button" class="btn btn-danger" data-dismiss="modal">No</button>
</div>
</div>
</div>
</div>
</div>
这是我要删除的views.py
class ItemDeleteView(DeleteView):
model = Item
# template_name = 'index.html'
success_url = reverse_lazy('index')
login_url = '/accounts/login/'
def get(self, request, *args, **kwargs):
return self.post(request, *args, **kwargs)
我不知道该怎么办。现在...谢谢
【问题讨论】:
标签: html django django-views