Ber*_*ant 21
您可以在ModelAdmin中声明一个函数来为您的按钮生成html,例如
def button(self, obj):
return mark_safe('<input type="...">')
title.short_description = 'Action'
title.allow_tags = True
Run Code Online (Sandbox Code Playgroud)
然后把它放在你的list_display-tuple中.
class MyAdmin(admin.ModelAdmin)
list_display=('name', 'button')
Run Code Online (Sandbox Code Playgroud)
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-options