I have the following:
base.html
<html>
{% include 'header.html' %}
<div>
{% block content %}Default Content{% endblock %}
</div>
</html>
header.html
<header>
{% block logo %}Logo 1{% endblock %}
</header>
homepage.html
{% extend 'base.html' %}
{% block logo %}Logo 2{% endblock %}
{% block content %}Yap Yap Yap{% endblock %}
Essentially, this doesn’t work. When I render the homepage.html I get:
<html>
<header>Logo 1</header>
<div>Yap Yap Yap</div>
</html>
but If I move the code in header.html into base.html (i.e. get rid of the include altogether) it works ok. Can anyone explain why this is the case?
I have a feeling it has something to do with the included templates getting rendered after their parents have been rendered?
from the docs
so the subtemplate (
header.html) is getting fully rendered and inserted into the parent template (base.html), meaning there is no concept of the block for the child template (homepage.html) to overwrite