Dexterity中的多值属性(Multivalued attributes in Dexterity)

系统教程 行业动态 更新时间:2024-06-14 16:53:13
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"), ))

更多推荐

本文发布于:2023-04-06 01:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/955b1a1928c936e1836b3a4585bb1399.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   Dexterity   attributes   Multivalued

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!