默认的“删除所选择的”在Django中的管理操作 [英] The default "delete selected" admin action in Django

查看:113
本文介绍了默认的“删除所选择的”在Django中的管理操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除或更改Django管理面板中默认管理操作删除所选X项目的详细名称?

How can I remove or change the verbose name of the default admin action "delete selected X item" in the Django admin panel?

推荐答案

不知道这种猴子修补是一个好主意,但是在我的一个 admin.py 中为我推荐:

Not sure if this sort of monkey-patching is a good idea, but shoving this in one of my admin.py works for me:

from django.contrib.admin.actions import delete_selected
delete_selected.short_description = u'How\'s this for a name?'

这将更改管理员网站的所有 的详细名称。如果你想改变一个特定型号的管理员,我想你需要写一个自定义管理操作

This will change the verbose name for all your admin sites. If you want to change it just for one particular model's admin, I think you'll need to write a custom admin action.

使用Django 1.1版测试:

Tested with Django version 1.1:

>>> import django
>>> django.VERSION
(1, 1, 0, 'beta', 1)

这篇关于默认的“删除所选择的”在Django中的管理操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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