Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Wagtail-来自子页面的参考表单_Python_Django_Wagtail - Fatal编程技术网

Python Wagtail-来自子页面的参考表单

Python Wagtail-来自子页面的参考表单,python,django,wagtail,Python,Django,Wagtail,我正在使用,以便站点实现人员可以扩展以使用自己的站点特定模板创建自己的FormPage类型 我想呈现父页面上的所有表单页面;这包括所有子页面字段,如标题,以及完整的子表单 理想情况下,“提交”按钮也应按表单进行操作 以下是我尝试过的: <ul> {% for child in page.get_children %} <li> <h5 class=>{{ child.specific.title }}</h5>

我正在使用,以便站点实现人员可以扩展以使用自己的站点特定模板创建自己的FormPage类型

我想呈现父页面上的所有表单页面;这包括所有子页面字段,如标题,以及完整的子表单

理想情况下,“提交”按钮也应按表单进行操作

以下是我尝试过的:

<ul>
    {% for child in page.get_children %}
    <li>

        <h5 class=>{{ child.specific.title }}</h5>

        <div>

            {{ child.specific.intro|richtext }}

            <div id="form-holder">

                <form action="{% child.pageurl page %}" method="POST">
                    {% csrf_token %}
                    {{ child.specific.form.as_p }}
                    <input type="submit">
                </form>

            </div><!-- contact-form-holder-->

        </div>
    </li>
    {% endfor %}
</ul>
我发现,如果使用
.specific
方法,我可以呈现子页面字段,如title和intro

然而,我似乎无法得到任何形式的渲染;带或不带
.specific
标记


欢迎任何帮助

离题,但可能有任何帮助:

{page.get_children%}

可替换为:


{%for child in page.get_children.specific%}

这里有一个非常类似的问题的答案:
class FormField(AbstractFormField):
    db_table = 'form_field'

    page = ParentalKey('FormPage', related_name='form_fields')


class FormPage(AbstractEmailForm):
    db_table = 'form_page'

    header = models.CharField(max_length=250)
    intro = RichTextField(blank=True)
    thank_you_text = RichTextField(blank=True)

    content_panels = AbstractEmailForm.content_panels + [
        FormSubmissionsPanel(),
        FieldPanel('intro', classname="full"),
        FieldPanel('header'),
        InlinePanel('form_fields', label="Form fields"),
        FieldPanel('thank_you_text', classname="full"),
        MultiFieldPanel([
            FieldRowPanel([
                FieldPanel('from_address', classname="col6"),
                FieldPanel('to_address', classname="col6"),
            ]),
            FieldPanel('subject'),
        ], "Email"),
    ]