我可以在管理 ListView 中列出图像缩略图。我在我的模型中做到了这一点
def category_image(self):
return '<img height=100px; width=100px; src="{}" />'.format(self.category_media.url)
category_image.short_description = 'Image'
category_image.allow_tags = True
但是当我去更改 View 时,我看不到图像。我刚得到网址。 我也想要一个缩略图。我该怎么做?
请您参考如下方法:
尝试替换'<img ...'与 <img style="height=100px; width=100px;" src="{}" /> .
