📜  list_display django 外键 - Python 代码示例

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

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

    def get_author(self, obj):
        return obj.book.author
    get_author.short_description = 'Author'
    get_author.admin_order_field = 'book__author'