修改admin代码

class Ad_CampaingAdmin(admin.ModelAdmin):
    list_display = ("content","preview")

    def preview(self,obj):

        return '<img src="/static/%s" height="64" width="64" />' %(obj.photo)

preview.allow_tags = True

preview.short_description = "图片"

 

这就ok了

相关文章:

  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案