admin.py中
list_display = ['id','Photo']
def Photo(self,obj):
return '<img src="/static/image/%s" height="22" width="22" />' %(obj.headPhoto)
Photo.allow_tags = True
Photo.short_description = "头像"
定义一下函数,路径改成你自已的,Photo.allow_tags= True为显示
django1.11.5版本在后台显示图片方法,
最新推荐文章于 2021-04-08 20:13:28 发布