How to define default views in Plone

I already have a page template for the standard presentation of the Plone website (main page). How to determine the default view for a folder? This default view should use the page template.

+4
source share
3 answers

Try the following:

  • select the desired folder
  • add "/ manage_propertiesForm" at the end of the URL
  • in the resulting form add this property:
    • name: "layout"
    • type: "string"
    • value: page template name without extension
+7
source

Use the answers above if you want to set one of the default views (tabular, thumbnail, etc.), but if you want to select a specific content item for the default view for the folder, you can do this in ZMI as suggested:

  • select the desired folder
  • add "/ manage_propertiesForm" at the end of the URL
  • in the resulting form add this property:
    • name: "default_page"
    • type: "string"
    • value: content item identifier

or do it programmatically in Python:

content_id = "Name of the Content Item" folder.manage_addProperty('default_page', content_id, 'string') 

Hope this helps!

+6
source

Using the information and links sent by both Giacomo Spettoli and Mikko Ohtamaa, another guy from my work team was able to find a solution for our case:

  • do as indicated by Giacomo (navigate to the desired folder, etc.).
  • include the new directive in the configure.zcml file (this was found by my team assistant Mr. Mariano):

     <browser:page for="OFS.interfaces.IFolder" name=<name of the page template file> class=<name of the class used by the above template file> permission="zope2.View" /> 

Thanks to Giacomo and Mikko; their answers helped us solve this problem.

+2
source

Source: https://habr.com/ru/post/1391682/


All Articles