How I order behavior IDublinCore in Dexterity Type?

廉价感情. 提交于 2019-12-19 19:44:35

问题


I'm writing a product using Python Dexterity Type, and I have Title and Description, this fields come from a behavior plone.app.dexterity.behaviors.metadata.IDublinCore, but I neeed reorder this fields with my fields.

Example:

My fields: document, collage, age, biography

IDublinCore: Title, Description

The order: collage, Title, document, age, biography, Description

How I Do it?


回答1:


Since you got your own Dexterity Type you can handle with form directives aka setting taggedValues on the interface.

from plone.autoform import directives


class IYourSchema(model.Schema):

    directives.order_before(collage='IDublinCore.title')
    collage = schema.TextLine(
        title=u'Collage',
    )

You find excellent documentation about this feature in the plone documentation http://docs.plone.org/external/plone.app.dexterity/docs/reference/form-schema-hints.html#appearance-related-directives




回答2:


How about using Jquery? (Since the fieldsets are using Jquery anyway)

For example to move Tags under Summary....

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

Note: This is a copy of my answer here



来源:https://stackoverflow.com/questions/40092789/how-i-order-behavior-idublincore-in-dexterity-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!