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

And*_*ndy 5 plone fieldset dexterity z3c.form

我在dexterity内容类型中有一些代码,如下所示:

form.fieldset(
    'transitionsLog',
    label=_(u"Transitions Log"),
    fields=['t_log']
)
form.mode(t_log='hidden')
t_log = schema.TextLine(
    title=_(u'Transitions log'),
)
Run Code Online (Sandbox Code Playgroud)

在添加/编辑表单中,字段t_log隐藏但字段集选项卡"转换日志"仍显示在表单中,如上所示... 在此输入图像描述

我不知道在添加/编辑表单中隐藏"过渡日志"选项卡,

我能怎么做 ?

Mat*_*ias 6

由于字段仍以隐藏模式呈现,因此字段集仍然存在.

如果要完全省略字段集,则需要省略字段集中的所有字段.这可以使用该omitted指令实现form.omitted.

form.fieldset(
    'transitionsLog',
    label=_(u"Transitions Log"),
    fields=['t_log']
)
form.omitted('t_log')  # This will also omit your fieldset
t_log = schema.TextLine(
    title=_(u'Transitions log'),
)
Run Code Online (Sandbox Code Playgroud)