I am following this tutorial on building a basic blog using the Django CMS and am encountering a strange behavior. It all started when I discovered that the Content area was not being created in the Structure section of the CMS. While investigating it, I discovered the strange behavior.
Here it is.
base.html:
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% block content %}{% endblock %}
</div>
</div>
</div>
<hr>
content.html:
{% extends "base.html" %}
{% load cms_tags %}
{% block content %}
{% placeholder content or%}
{% endplaceholder %}
{% endblock content %}
This configuration above displays no Content block on the Structure page of the CMS. However, if I change the base.html snippet to the following, it works.
base.html:
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% placeholder content or%}
{% endplaceholder %}
</div>
</div>
</div>
<hr>
Could someone tell me why this happens? What am I missing in how Django handles the template blocks? It appears to me that the two cases should be treated identically. Yet, the result is obviously different. The tutorial claims that I should be changing the content.html side. However, as illustrated above, that does not work.
Any elucidation is appreciated!
I was able to resolve this using the following modifications.
base.html:
<!-- Main Content -->
{% placeholder content or %}
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% block content %}{% endblock %}
</div>
</div>
</div>
<hr>
{% endplaceholder %}
content.html:
{% extends "base.html" %}
{% load cms_tags %}
{% block content %}
{% endblock content %}