xadmin列表页去掉删除按钮delete_selected

阅读更多

xadmin-for-py3环境

 

在ModelAdmin类中,加上以下has_delete_permission方法即可:

 

class ProductAdmin(object):
    list_display = ("code",)
    list_display_links = ("code",)
    search_fields = ["code", "pid"]
    
    def has_delete_permission(self):
        return False

 xadmin.sites.site.register(Product, ProductAdmin)

 

 

你可能感兴趣的:(xadmin,delete_selected,xadmin按钮定制)