在Plone&Dexterity中创建自定义编辑表单,如何保存对对象的更改?



我们正在做一个学生项目,我们必须使用Plone和Dexterity内容类型。

我们创建了一个自定义内容类型,现在正在尝试为它创建一个自定义编辑表单。但是,我们似乎无法将我们在编辑表单中输入的任何内容保存到对象本身。

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
  lang="en"
  metal:use-macro="context/main_template/macros/master"
  i18n:domain="pacs.content">
<body>

<metal:main fill-slot="main">
    <metal:main define-macro="main"
       tal:define="currentSelection view/selected_org_unit">
    <div tal:replace="structure provider:plone.abovecontenttitle" />
    <h1 class="documentFirstHeading" tal:content="context/title" />
    <div tal:replace="structure provider:plone.belowcontenttitle" />
    <p class="documentDescription" tal:content="context/shortname" />
    <div tal:replace="structure provider:plone.abovecontentbody" />
    <div tal:content="structure context/projectnr" />        
    <div>
    <fieldset style="border:1px #000 solid">
    <legend>Bereichszuordnung</legend>
        <select name="org_unit" size="1">
            <option value="">Bitte auswählen</option>
            <option
                    tal:repeat="code view/org_units"
                    tal:attributes="value code;
                                            selected python:currentSelection == code and 'selected' or None"
                    tal:content="code"
            />
        </select>
    </fieldset>
    </div>
    <div tal:content="structure context/org_unit" />
    <div tal:content="structure context/project_head" />
    <div tal:content="structure context/confidential" />
    <input id="form-buttons-save" 
    name="form.buttons.save" class="submit-widget button-field context" value="Save" type="submit" />        
    <div tal:replace="structure provider:plone.belowcontentbody" />
    <div metal:use-macro="context/batch_macros/macros/navigation" />
</metal:main>
</metal:main>

提前感谢您可以提供的任何帮助,我很乐意上传任何相关代码。

是否注册编辑表单?

class EditForm(dexterity.EditForm):
    grok.context(IYourContentType)

查看自定义添加和编辑表单了解更多信息

最新更新