作为另一种选择,您可以进行如下查找:
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'
欢迎分享,转载请注明来源:内存溢出
作为另一种选择,您可以进行如下查找:
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'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)