django admin 理解

http://python.usyiyi.cn/django/ref/contrib/admin/index.html html

list_display = ()  # 在list页面展现的字段
fields = (()) # 在修改页面展现的字段  在同个()中显示一行
readonly_fields = () # 在修改页面中的只读字段
actions_on_bottom = actions_on_top =

http://python.usyiyi.cn/django/ref/contrib/admin/actions.html  actions 具体操做python

actions = ['del_people']

def del_people(self, request, obj):
    for a in obj:
        if a.name == u'苏豪':
            self.message_user(request, u"草哦草哦吃")  # 反馈
        else:
            a.delete()
del_people.short_description = "吃人"
相关文章
相关标签/搜索