【问题标题】:How I order behavior IDublinCore in Dexterity Type?我如何在敏捷类型中订购行为 IDublinCore?
【发布时间】:2016-10-17 17:58:45
【问题描述】:

我正在使用 Python Dexterity Type 编写产品,并且我有 TitleDescription,此字段来自行为 plone.app.dexterity.behaviors.metadata.IDublinCore,但我需要使用我的字段重新排序此字段。

例子:

我的领域:文档、拼贴、年龄、传记

IDublinCore:标题、描述

顺序:拼贴、标题、文档、年龄、传记、描述

我是怎么做的?

【问题讨论】:

    标签: python plone zope dexterity plone-4.x


    【解决方案1】:

    既然你有自己的敏捷类型,你可以在界面上使用form directives aka setting taggedValues

    from plone.autoform import directives
    
    
    class IYourSchema(model.Schema):
    
        directives.order_before(collage='IDublinCore.title')
        collage = schema.TextLine(
            title=u'Collage',
        )
    

    您可以在 plone 文档 http://docs.plone.org/external/plone.app.dexterity/docs/reference/form-schema-hints.html#appearance-related-directives 中找到有关此功能的出色文档

    【讨论】:

    • 像手套一样工作,简单而 Pythonic,谢谢!
    【解决方案2】:

    使用 Jquery 怎么样? (因为无论如何字段集都在使用 Jquery)

    例如将标签移动到摘要下......

    $('body.template-edit.portaltype-document #formfield-form-widgets-IDublinCore-subjects').insertAfter('#formfield-form-widgets-IDublinCore-description')
    

    注意:这是我的答案here的副本

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-18
    相关资源
    最近更新 更多