📜  list_display - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:54.500000             🧑  作者: Mango

代码示例1
class MyModelAdmin(admin.ModelAdmin):
    list_display = ('get_sub_title',)

    def get_sub_title(self, obj):
        if obj.sub_title:
            return obj.sub_title
        else:
            return 'Not Available'

    get_sub_title.short_description = 'Subtitle'