- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我是 Plone 的新手,我正在尝试灵活地使用 DataGridField。目标是使用 Plone 4.1 在我们的内部网上发布可用性研究的结果。我创建了一个自定义文档类型(称为交互),我想对其中一个字段使用数据网格来为包含两列的表建模,这些列显示调查结果的摘要。
按照 collective.z3cform.datagridfield 中列出的说明我已经成功地将 collective.z3cform.datagrid egg 添加到我的构建中的 egg 列表中,我可以看到新的附加组件在我的站点的附加组件列表中显示为事件。我创建了一个简单的模式 Python 模块,它描述了一个文档,该文档显示了我正在记录的可用性研究的结果:
from five import grok
from zope import schema
from zope import interface
from plone.directives import form
from plonetheme.mytheme import InteractionMessageFactory as _
from plone.app.textfield import RichText
from z3c.form import field, button
from Products.CMFCore.interfaces import IFolderish
from collective.z3cform.datagridfield import DataGridFieldFactory, DictRow
class IFinding(interface.Interface):
summary = schema.TextLine(title=_(u"Summary"))
percentage = schema.TextLine(title=_(u"Percentage"))
class IInteraction(form.Schema):
findings = schema.List(
title=_(u"Overview of findings"),
required=False,
value_type=DictRow(
title=_(u"Finding"),
schema=IFinding
)
)
class EditForm(form.EditForm):
grok.context(IInteraction)
grok.require('zope2.View')
fields = field.Fields(IInteraction)
fields['findings'].widgetFactory = DataGridFieldFactory
我已经通过向 profiles/default/types.xml 添加一行来注册我的新交互内容类型:
<?xml version="1.0"?>
<object meta_type="Plone Types Tool" name="portal_types">
<property name="title">Controls the available content types in your portal</property>
<object meta_type="Dexterity FTI" name="interaction" />
<!-- -*- extra stuff goes here -*- -->
</object>
为了完整起见,我还包含了相应的 profiles/default/types/interaction.xml 文件:
<?xml version="1.0"?>
<object name="interaction" meta_type="Dexterity FTI"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="title">Interaction</property>
<property name="description">An item in the interactions dictionary</property>
<property name="icon_expr">string:${portal_url}/document_icon.png</property>
<property name="factory">interaction</property>
<property name="link_target"></property>
<property name="immediate_view">view</property>
<property name="global_allow">True</property>
<property name="filter_content_types">True</property>
<property name="allowed_content_types"/>
<property name="allow_discussion">False</property>
<property name="default_view">view</property>
<property name="view_methods">
<element value="view"/>
</property>
<property name="default_view_fallback">False</property>
<property name="add_permission">cmf.AddPortalContent</property>
<property name="klass">plone.dexterity.content.Item</property>
<property name="behaviors">
<element value="plone.app.dexterity.behaviors.metadata.IDublinCore"/>
<element value="plone.app.content.interfaces.INameFromTitle"/>
<element value="collective.flowplayer.behaviors.IFlowplayerFile"/>
</property>
<property name="schema">plonetheme.mytheme.interaction.IInteraction</property>
<property name="model_file"></property>
<alias from="(Default)" to="(dynamic view)"/>
<alias from="edit" to="@@edit"/>
<alias from="sharing" to="@@sharing"/>
<alias from="view" to="(selected layout)"/>
<action title="View" action_id="view" category="object" condition_expr=""
icon_expr="" link_target="" url_expr="string:${object_url}"
visible="True">
<permission value="View"/>
</action>
<action title="Edit" action_id="edit" category="object" condition_expr=""
icon_expr="" link_target="" url_expr="string:${object_url}/edit"
visible="True">
<permission value="Modify portal content"/>
</action>
</object>
当我转到交互自定义类型的添加表单时,我得到一个标准的敏捷列表项添加/删除小部件,而不是我在 collective.z3cform.datagrid_demo 示例中看到的数据网格表小部件。当我尝试保存自定义类型时,敏捷列表小部件显示验证错误“系统无法处理给定值。”
我还需要添加其他代码吗?我是否需要覆盖 Dexterity Add/EditForm View 模板?
最佳答案
您按照记录在做,但行不通。这是一个已知问题:
关于python - 灵活使用 collective.z3cform.datagridfield,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8301094/
我在一个C++程序中找到了一段代码,好像每隔for()循环两次。在这个程序中循环,但为什么在这样的预处理器定义中需要第三个 for 呢? #define for for(int z=0;z<2;++z
我正在尝试分割其中有一个小写字母后跟一个大写字母的文本。 假设文本是: “Įvairių rūšiųSkinti kardeliai” 我想在“ųS”处拆分它,但是以下正则表达式“[ą-ž][Ą-Ž]
这个问题在这里已经有了答案: Reference - What does this regex mean? (1 个回答) 关闭 2 年前。 下面的正则表达式有什么区别。对我来说,它们都是一样的 [
我正在尝试用 Java 编写一个正则表达式: "/[A-Z]{6}-[A-Z]{4}-[A-Z]{4}/" 但是它不起作用。例如 "AASAAA-AAAA-AAAA".matches("/[A-Z]{
我需要确定一个字符串是否是一个变量标识符。 即(a-z,A-Z,,$) 后跟 (a-z,A-Z,0-9,,$) 我知道我可以使用手动配置的 reg exp 来完成它,但必须有一个更紧凑的内置函数我可以
早上好,我是新来的,我带来了一个小问题。我无法针对以下问题开发有效的算法:我需要找到三个正数 x、y 和 z 的组合,以便 x + y、x - y、y + z、y - z、x + z 和 x - z
这个问题已经有答案了: How does the ternary operator work? (12 个回答) 已关闭 6 年前。 我发现了一种不同的返回值的方式,并且很兴奋。它到底是什么意思? 如
我需要以下正则表达式,允许 [a-zA-Z]+ 或 [a-zA-Z]+[ \\-]{0,1}[a-zA-Z]+ 所以我想在 a-zA-Z 字符之间允许无限的减号和空格 示例: sdfsdfdsf-sf
我正在编写一个代码,它以“代码”(编码理论)作为输入,并且我已经计算了它的权重枚举器。我想使用 MacWilliams Identity 找到双代码的权重枚举器. 我有W(z) ,代码的权重枚举器,我
我已经编写了一个 child 文字游戏,现在我正在尝试优化性能。游戏以一种特殊的方式从数据库中挑选关键词,我想做得更好。 给定一个按字母数字排序的 MySQL 关键字字段: keyword s
假设一个字符串是abc/xyz/IMPORTANT/DATA/@#!%@!%,我只想要IMPORTANT/DATA/!%#@%!#% 我对正则表达式很烂,而且真的还没学过 JavaScript API
JS代码: ? 1
大家晚上好我想知道有没有更快的方法来生成以下形式的列表? [a,b,c,…,z] → [[z], [y,z], [x,y,z], … , [a,b,…,y,z]] 我知道切片是最好的方法之一,但没有更
我在 Firefox 和其他浏览器上遇到嵌套 z-index 的问题,我有一个 div,z-index 为 30000,位于 label 下方> zindex 为 9000。我认为这是由 z-inde
我正在尝试制作一个灯泡。这是代码 JSfiddle HTML 查询 $('.button').click(function() { $('#add').show();
在您想将嵌套模块导入命名空间的情况下,我总是这样写: from concurrent import futures 不过,我最近意识到这也可以使用“as”语法来表达。请参阅以下内容: import c
我正在尝试创建一个基本上复制 matlab 命令的函数:[z;-z] 其中 z = randn(m,n) 返回一个 m -by-n 随机条目矩阵。我能够在 C++ 中为下面的 randn 函数创建一个
好吧,我迷失在这些指针中,有人能准确地告诉我 char * x,y,z; 和 char* x,y,z 之间的区别是什么; 和 char (*)x,y,z; ?如果可以,请为您的答案或其他内容提供资源。
这是一道函数依赖题。 我知道当 x->yz 然后 x->y 和 x->z 时。但是上面的依赖关系可能吗? 最佳答案 If xy determines z can x determine z and y
我有一个列表列表 nLedgers - 一个 3D 点云: [nodeID, X, Y, Z] 多行。一些节点将具有相同的 X 和 Y 坐标以及不同的 Z 坐标。 我想首先确定具有相同 X 和 Y 坐
我是一名优秀的程序员,十分优秀!