Django CMS - check if placeholder is empty

后端 未结 5 2045
遥遥无期
遥遥无期 2021-02-14 04:16

I use:

  • DjangoCMS 2.4
  • Django 1.5.1
  • Python 2.7.3

I would like to check if my placeholder is empty.

{
5条回答
  •  故里飘歌
    2021-02-14 04:50

    If you want additional content to be displayed in case the placeholder is empty, use the or argument and an additional {% endplaceholder %} closing tag. Everything between {% placeholder "..." or %} and {% endplaceholder %} is rendered in the event that the placeholder has no plugins or the plugins do not generate any output.

    Example:

    {% placeholder "content" or %}
    
    There is no content.
    
    {% endplaceholder %}
    

提交回复
热议问题