Отображается только html-тег.
setting.pyMEDIA_ROOT = '/home/apheyhys/PycharmProjects/jhchase/media/'
MEDIA_URL = '/media/'
urls.pyfrom django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('novels.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
models.pyclass Cover(models.Model):
name_cover = models.CharField(max_length=100, blank=True, null=True)
cover = models.ImageField()
def image_img(self):
return u'<img src="%s" />' % str(self.cover.url)
image_img.short_description = 'Изображение'
image_img.allow_tags = True
admin.pyclass CoverAdmin(admin.ModelAdmin):
list_display = ("cover", "image_img")
readonly_fields = ("image_img",)
admin.site.register(Cover, CoverAdmin)
Может кто-то сталкивался с тем-же?