diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/blocks/struct.html b/wagtail/wagtailadmin/templates/wagtailadmin/blocks/struct.html deleted file mode 100644 index ce08f18c09..0000000000 --- a/wagtail/wagtailadmin/templates/wagtailadmin/blocks/struct.html +++ /dev/null @@ -1,6 +0,0 @@ -
- {% for key, val in self.items %} -
{{ key }}
-
{{ val }}
- {% endfor %} -
diff --git a/wagtail/wagtailcore/blocks/struct_block.py b/wagtail/wagtailcore/blocks/struct_block.py index f8eb75509e..e0263b26b5 100644 --- a/wagtail/wagtailcore/blocks/struct_block.py +++ b/wagtail/wagtailcore/blocks/struct_block.py @@ -11,6 +11,7 @@ from django.template.loader import render_to_string from django.utils import six from django.utils.encoding import python_2_unicode_compatible from django.utils.functional import cached_property +from django.utils.html import format_html, format_html_join from .base import Block, DeclarativeSubBlocksMetaclass from .utils import js_dict @@ -175,9 +176,12 @@ class BaseStructBlock(Block): return errors + def render_basic(self, value, context=None): + return format_html('
\n{}\n
', format_html_join( + '\n', '
{}
\n
{}
', value.items())) + class Meta: default = {} - template = "wagtailadmin/blocks/struct.html" form_classname = 'struct-block' form_template = 'wagtailadmin/block_forms/struct.html' # No icon specified here, because that depends on the purpose that the