[Answer]-Don´t show image in admin site

1👍

You can’t just give paths to files on the disk of your server, you need to actually serve the files through your webserver and use django’s django.contrib.staticfiles to reference those files from within your application:

def boton(self,obj):
    return mark_safe('<img src="{{ STATIC_URL }}admin/img/pdf.png" alt="PDF">')

0👍

Try this will work as expected.

def image_data(self, obj):
    return mark_safe('<img src="{{ STATIC_URL }}%s"alt="PDF" width=50 height=50>' %( str(obj.image_file) ))

Leave a comment