我已经覆盖了 list_display 以显示这样的内联字段:
class opportunityAdmin(admin.ModelAdmin):
list_display = ('name', 'Contact', 'Phone', 'Address', 'discovery_date', 'status' , 'outcome')
search_fields = ['name', 'tags' , 'description']
#readonly_fields = ('discovery_date','close_date')
inlines = [account_contactInline, account_updateInline]
def Contact(self, obj):
return '<br/>'.join(c.account_poc for c in account_contact.objects.filter(opportunity=obj.id).order_by('id')[:1])
def Phone(self, obj):
return '<br/>'.join(c.account_phone for c in account_contact.objects.filter(opportunity=obj.id).order_by('id')[:1])
def Address(self, obj):
return '<br/>'.join(c.account_address for c in account_contact.objects.filter(opportunity=obj.id).order_by('id')[:1])
我的问题是,在 Django admin 中,内联字段标题的显示名称分别使用了函数名称:联系人、电话和地址。实际上我想用自定义文本显示那些字段标题。我什至想用中文来显示它们。我错过了什么?