如何跳过特定模型的Django管理中的删除确认页面? [英] How to skip delete confirmation page in Django admin for specific model?

查看:49
本文介绍了如何跳过特定模型的Django管理中的删除确认页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含大量数据的模型,并且Django很长时间创建了删除确认页面.我必须跳过此过程并删除数据而无需任何确认.我已经尝试了一些来自Internet的解决方案,但是它不起作用-我仍然看到确认页面.

I have a model with a huge amount of data, and Django creates delete confirmation page a very long time. I have to skip this process and delete data without any confirmation. I have tried some solutions from the internet, but it doesn't work - I still see confirmation page.

有人知道怎么做吗?

推荐答案

def delete_selected(modeladmin, request, queryset):
    queryset.delete()

class SomeAdmin(admin.ModelAdmin):
    actions = (delete_selected,)

这篇关于如何跳过特定模型的Django管理中的删除确认页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆