我想将admin屏幕的下拉列表中的delete_selected操作显示为仅适用于一个模型的最后一个选项。
I managed to make it work like this. Would be there a nicer way?
class MyModelAdmin(admin.ModelAdmin):
actions = ['soft_delete_selected', 'soft_undelete_selected']
def get_actions(self, request):
actions = super(MyModelAdmin, self).get_actions(request)
action = actions['delete_selected']
del actions['delete_selected']
actions['delete_selected'] = action
return actions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.