Gurus, I searched this problem many times, but I could not find useful information.
Suppose we have a template base.html:
{% block test %}This is the base!{% endblock %}
And 2 child patterns under this, a.htmlandb.html
a.html:
{% extends "base.html" %}
{% block test %}This is the A!{% endblock %}
b.html
{% extends "base.html" %}
{% block test %}This is the B!{% endblock %}
Now we have the 4th template as root.html
<html>
<body>
{% include 'a.html' %}
{% include 'b.html' %}
{% include 'base.html' %}
</body>
</html>
So, when I do root.html rendering, I expect to get sth like:
This is A! This is B! This is the base!
But it’s strange what I got, always:
This is A! This is A! This is A!
Why is this exactly happening?
source
share