1

我有一个 dexterity.AddForm 并且我想要一个列表小部件来接受对象的值类型。

我有一个对象值类型的接口:

class IMyObject(Interface):
    field_a = schema.TextLine(
        title = u"Field A",
    )

    field_b = schema.TextLine(
        title = u"Field B",
    )

然后对于敏捷内容类型,我有这个:

class IMyContentType(Interface):
    combines = schema.List(title=_(u'List of object value type test'),
                           value_type=schema.Object(schema=IMyObject),
                           required=False,
                      )

class MyContentType(Container):
    grok.implements(IMyContentType)

我的灵巧度.AddForm:

class Add(dexterity.AddForm):
    grok.context(IMyContentType)
    grok.name('my.package.mycontenttype')

不幸的是,当我尝试提交时,小部件中显示错误:系统无法处理给定值。

对于接口类 IMyContentType,我尝试了 model.Schema 和 form.Schema 只是为了看看这是否会有所作为,但它没有。我想我可能走错了路。尝试实现具有对象值类型的列表的更好方法是什么?

4

0 回答 0