Plone: How to sort folder items

只愿长相守 提交于 2019-12-06 04:44:29

问题


I have a folder called myfolder, that has some items inside, like: item1, item2, item3, and etc.

When I added the portlet Navigation to the left column of the page, and entered on the folder myfolder, it showed me the links on the portlet like this:

  • item1
  • item2
  • item3

I want that the Navigation portlet shows me links on this exact sort:

  • item2
  • item1
  • item3

I know that I can go on the Content tab of myfolderenter code here, and drag each item to the position that I want.
But using this way, if I reinstall all my product on a new Plone Site, I lost my configuration. So I want to have this navigation order configured on my product, instead of only on a installed plone site, so that this change stays forever.

How can I do that?


回答1:


Solved: I could solve this by doing under the installation of the product:

#file: Extensions/Install.py
def install(portal):

    #...another steps from install

    portal = getToolByName(portal, 'portal_url')
    portal = portal.getPortalObject()

    portal.moveObjectsToTop(['item2', 'item1', 'item3', ])
    portal.plone_utils.reindexOnReorder(portal)

Just this.



来源:https://stackoverflow.com/questions/3668539/plone-how-to-sort-folder-items

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