How to override Django base template

You can use template blocks to achieve this. For example, in base.html, surround the HTML elements in a named block:

{% block a_unique_name %}<div>This is only relevant in base.html</div>{% endblock %}

The HTML in the block will be used only if no other template overrides it. You can override it in your sub-template like this:

{% extend base.html %}
{% block a_unique_name %}{% endblock %}

Now the value from sub-template will be used and will override the default value from base.html.