Files
old-saburly-wagtail-web/env/lib/python3.10/site-packages/wagtail/images/components.py
2024-08-27 20:33:44 +02:00

12 lines
376 B
Python

from wagtail.admin.ui.fields import BaseFieldDisplay
from wagtail.images.shortcuts import get_rendition_or_not_found
class ImageDisplay(BaseFieldDisplay):
rendition_spec = "max-400x400"
def render_html(self, parent_context):
if self.value is None:
return None
return get_rendition_or_not_found(self.value, self.rendition_spec).img_tag()