I have 3 Django templates:
base.html
<title>{% block title %} SITE NAME {% endblock %}</title>
default.html
{% extends "base.html" %}
{% block title %} {{ block.super }} - SECTION NAME {% endblock %}
main.html
{% extends "default.html" %}
{% block title %} {{ block.super }} {% endblock %}
I'd like to get SITE NAME in template main.html i.e. the content of the parent of the parent block. Something like
{{ block.super.super }}
Is this possible?
Note, Django 1.2.3 seems to already do what you want. Assuming SITE_NAME is exposed via a context_preprocessor like lzerscience illustrates, block.super should expose it through all the layers of inheritance.
main.html
{% extends "default.html" %}
{% block title %} {{ block.super }} - MAIN{% endblock %}
That displays the title "SITE NAME - SECTION NAME - MAIN" for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With