I have read the 'custom-editing-interfaces-for-structblock' section of documentation. Then I have written:
settings = StructBlock([
('width', blocks.CharBlock(required=False, max_length=20 ) ),
('background_color', blocks.CharBlock(max_length=10, required=False))
], form_template = 'personal_web/admin_blocks/section_settings.html' )
I have copied the code in wagtail/admin/templates/wagtailadmin/block_forms/struct.html to my custom struct template for better customizing.
--- my section_settings.html ---
<div class="{{ classname }}">
{% if help_text %}
<div class="object-help help">{{ help_text }}</div>
{% endif %}
<ul class="fields">
{% for child in children.values %}
<li{% if child.block.required %} class="required"{% endif %}>
{% if child.block.label %}
<label{% if child.id_for_label %} for="{{ child.id_for_label }}"{% endif %}>{{ child.block.label }}:</label>
{% endif %}
{{ child.render_form }}
</li>
{% endfor %}
</ul>
</div>
On the admin there is an error:
'builtin_function_or_method' object is not iterable... In template /Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.6.1_dj_1_11/lib/python3.6/site-packages/wagtail/wagtailadmin/templates/wagtailadmin/block_forms/sequence_member.html, error at line 23
By the way I am using jinja as template renderer, django 1.11.6, python 3.6
I checked to see if this was an jinja2 issue I have changed the children.values properties children.values() etc...
Now on the admin I see all the elements as 'html string' not the actual input fields...
Thanks
section_settings.htmltemplate completely identical to wagtail/admin/templates/wagtailadmin/block_forms/struct.html? If not, please post your template code. Note that you cannot use jinja2 for this template - the Wagtail admin always uses the Django template engine for its templates, regardless of what you're using on your site frontend. - gasman