Reputation: 15147
Let's say I have this structure:
{# base.html #}
{% block content %}{% endblock %}
{# page.html #}
{% extends "base.html" %}
{% block content %}
{% include "snippet.html" %}
{# and I also want somehow to redefine {% block snippet_content %} of snippet here #}
{% endblock %}
{# snippet.html #}
<bells_and_whistles>
{% block snippet_content %}{% endblock %}
</bells_and_whistles>
I hope that the code is self-explaining.
Is there an elegant way to achieve this?
Upvotes: 1
Views: 665
Reputation: 4121
I'm afraid it is not possible in the way you want to do it.
Your options are:
modified_snippet.html
inheriting from snippet.html
and overriding the block and include it insteadsnippet_content
block to a {{ snippet_content }}
variable and pass its contents using {% include "snippet.html" with snippet_content="My content" %}
. Of course this method is quite limited.Upvotes: 1