EDIT
As the OP mentioned in the comments, the requirements are quite different from what I could interpret. Thus, the fix that can be used based on my newer understanding is simply {% include 'section.html' %}
as aptly pointed out in Tsang-Yi Shen's comment.
base.html
:
<!-- HTML here.... -->
{% block normal_content %}{% endblock %}
section.html
<section>
<!-- Special Section -->
</section>
Wherever you want the section, just include section.html
login.html
and all others which require the special section:
{% extends "base.html" %}
{% block normal_content %}
Hey There!
{% block section %}
{% include 'section.html' %}
{% endblock %}
{% endblock %}
ORIGINAL ANSWER
Selcuk's answer explains the concept beautifully. I am adding to that answer by providing code examples for future reference.
Consider base.html
:
<!-- HTML here.... -->
<!-- Common Section -->
{% block section %}{% endblock %}
{% block normal_content %}{% endblock %}
<!-- End Common Section -->
Now use a template for your section, baseWithSection.html
:
{% extends 'base.html' %}
{% block section %}
<section>
....
</section>
{% endblock %}
{% block special_content %}{% endblock %}
For all pages that do not contain the section, extend base.html
like so:
{% extends 'base.html' %}
{% block normal_content %}
<!-- HTML here... -->
{% endblock %}
For the pages that do require the section, extend section.html
like so:
{% extends 'baseWithSection.html' %}
{% block special_content %}
<!-- Special HTML here, for templates pages requiring the section -->
{% endblock %}