I\'m trying to show thumbnail images in Django admin, but I can only see the path to the images, but not the rendered images. I don\'t know what I\'m doing wrong.
Se
Note that in Django v.1.9
image_tag.allow_tags = True
is depricated and you should use format_html(), format_html_join(), or mark_safe() instead
So your model.py should look like this:
...
def image_img(self):
if self.image:
return marksafe('
' % self.image.url_125x125)
else:
return '(Sin imagen)'
image_img.short_description = 'Thumb'
and in your admin.py add:
list_display= ('image_img','product',)
readonly_fields = ('image_img',)
and for adding it in the 'Edit mode' of your admin panel in your admin.py add:
fields = ( 'image_img', )