开发者

Plone: How to sort folder items

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜