【Django Admin】admin后台自定义返回显示属性
作者:互联网
# models.py class UserInfo(models.Model): head = fields.ImageField(verbose_name='照片', max_length=128, accept=".png") # Admin自定义返回列表PRO 例子:照片邮箱 def head_picture(self): return format_html('<img src="{}" height="50" width="50">', '{}'.format(self.head)) head_picture.short_description = '照片'
# admin.py list_display = ("head_picture",)
标签:picture,head,自定义,format,Admin,py,Django,models 来源: https://www.cnblogs.com/wanghong1994/p/16422906.html