What is the difference between {% placeholder content %} versus {% block content %}{% endblock %}?

StackOverflow https://stackoverflow.com/questions/21148159

  •  28-09-2022
  •  | 
  •  

Exactly the question title. What are the differences between the purpose of each code and how Django CMS renders the content?

有帮助吗?

解决方案

  • {% block content %}{% endblock %} is part of Django. It means you can override the contents of that code in a template that derives from that template. So once you've done that, the contents of the block have been changed but that is it - you'll simply see what the contents of the applicable block called content are.
  • {% placeholder content %} is part of Django CMS. It allows you to define sections on the page where you can place Django CMS plugins. This means Django CMS will detect where these placeholders are and it allows an administrator to specify what plugin goes into which placeholder. The difference with {% block content %}{% endblock %} is that you can change the contents at any time by going to the admin page and selecting a different plugin for that placeholder.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top