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

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

  •  28-09-2022
  •  | 
  •  

Question

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

Was it helpful?

Solution

  • {% 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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top