plone - 如何更改字段集顺序?

标签 plone dexterity z3c.form

我有一个从另一个表单架构继承的表单架构。两者都有fieldsets 。然而,字段集是按照它们创建的顺序放置的。因此最后一个模式中描述的字段集将是最后一个。我希望它是第一个。有办法做到这一点吗?

示例:

from plone.supermodel import model
from zope import schema

class FormSchema(model.Schema):
     model.fieldset(
          'test',
          label='Test',
          fields=['field1']
     )
     field1 = schema.Text(title=u'test')


class FormSchema2(FormSchema):
     # Is last but I would like to place it first
     model.fieldset(
          'test2',
          label='Test2',
          fields=['field2']
     )
     field2 = schema.Text(title=u'test2')

最佳答案

恐怕你不能。模式字段集总是以相反的接口(interface)解析顺序合并;派生接口(interface)之前的基础。在 FormSchema2 架构上再次声明字段集只会导致字段集列出两次。

如果您必须控制字段集顺序,请不要从基本架构派生,而是重新声明它。

关于plone - 如何更改字段集顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18999990/

相关文章:

plone - 如何在我的 Plone 4.3.9 站点中启用旧样式集合?

python - 如何以编程方式创建像 z3c.form 那样的详细事件?

plone - 如何在 Plone 添加/编辑表单中隐藏字段集(选项卡)

reference - ComponentLookupError : (<InterfaceClass zc. relation.interfaces.ICatalog>, '' ) 与 Dexterity 引用

plone - 在 z3c.form 中重写 CalendarDateConverter

python - 将 collective.z3cform.datagridfield 与 plone.app.registry 和 GenericSetup 一起使用

plone - Diazo - 替换 css 属性

python - 如何使用 python 脚本重命名文件?

python - 如何创建具有多个模式的 z3c.form?

plone - TinyMCE 工具栏不向匿名用户显示