work hard on this

This commit is contained in:
bkfox
2019-06-29 18:13:25 +02:00
parent a951d7a319
commit 74dbc620ed
31 changed files with 1191 additions and 833 deletions

20
aircox_web/renderer.py Normal file
View File

@@ -0,0 +1,20 @@
from django.utils.html import format_html, mark_safe
from feincms3.renderer import TemplatePluginRenderer
from .models import Page, RichText, Image
renderer = TemplatePluginRenderer()
renderer.register_string_renderer(
RichText,
lambda plugin: mark_safe(plugin.text),
)
renderer.register_string_renderer(
Image,
lambda plugin: format_html(
'<figure><img src="{}" alt=""/><figcaption>{}</figcaption></figure>',
plugin.image.url,
plugin.caption,
),
)