z3c.form的未选择小部件。
collective.formwidget.uberselect的Python项目详细描述
概述
此包提供与 z3c.formwidget.query它组合成一个uberselection小部件 z3c.form表单生成框架。
小部件的本机值类型是原型uid集合。
示例:
>>> from collective.formwidget.uberselect.archetypes import \ ... ArchetypesContentSourceBinder>>> class ISelection(interface.Interface): ... items = schema.Set( ... title=u"Selection", ... description=u"Search for content.", ... value_type=schema.Choice( ... source=ArchetypesContentSourceBinder() ... ) ... )
弱引用
将引用存储为persistent.wref.WeakRef而不是 uid是在表单和 上下文。
>>> from collective.formwidget.uberselect.wref import uid2wref>>> Factory = uid2wref(ISelection['items'])
为了存储弱引用而不是uid,您可以注册这样一个 工厂作为适应上下文的组件。工厂自动 提供定义字段的接口。