我想在管理界面的下拉列表中显示delete_selected操作作为一个模型的最后一个选项。
答案 0 :(得分:0)
我设法让它像这样工作。会有更好的方式吗?
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