zepp133
zepp133

Reputation: 1610

Extending the contents of an including template's block

In Django's templating language, you can extend the contents of a parent template's block by doing something like:

# child.html
{% extends "parent.html" %}
{% block some_block_in_parent %}
  {{ block.super }}
  ... additional content ...
{% endblock %}

Is the same possible in a template that does not extend another template but is included by one? Something along the lines of:

# including_template.html
{% include "included_template.html" %}

# included_template.html
{% block some_block_in_including_template %}
  {{ block.??? }}
  ... additional content ...
{% endblock %}

Upvotes: 1

Views: 43

Answers (1)

Chris Hawkes
Chris Hawkes

Reputation: 12410

Django does not process blocks in included files. This is for simple shared areas of the webpage, if you need to insert dynamic content in a block you will want to use a layout page.

Upvotes: 1

Related Questions