The default “delete selected” admin action in Django

后端 未结 8 1650
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 09:24

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

8条回答
  •  忘掉有多难
    2020-12-14 09:50

    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.

    Tested with Django version 1.1:

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

提交回复
热议问题