Dexterity中的多值属性(Multivalued attributes in Dexterity)
借助Dexterity,我可以创建一个具有电子邮件属性的联系人卡片模型。
class IContact(form.Schema): email = schema.TextLine( title=_(u"Email"), description=_(u"Contact email"), )如何修改此架构以为每个联系人提供多封电子邮件? 我知道可以将电子邮件添加为嵌套内容类型。 因此,我的问题是Dexterity是否支持内容类型中的多值属性。
With Dexterity I can create a model of contact cards having an email attribute.
class IContact(form.Schema): email = schema.TextLine( title=_(u"Email"), description=_(u"Contact email"), )How can I modify this schema to have multiple emails for each contact? I know that it is possible to add emails as a nested content type. Thus, my question is if Dexterity supports multivalued attributes inside content types.
最满意答案
当然可以,将电子邮件TextLine包装在schema.List :
schema.List( title=u"Email adresses", required=False, value_type=schema.TextLine( title=_(u"Email"), ))Sure it does, wrap the email TextLine in a schema.List:
schema.List( title=u"Email adresses", required=False, value_type=schema.TextLine( title=_(u"Email"), ))更多推荐
发布评论