Django extends Tag

Django extends Tag

Extends

The extends tag allows you to add a parent template for the current template.

This means that you can have one master page that acts like a parent for all other pages:

Example

mymaster.html:

template.html:

Run Example »

You put placeholders in the master template, telling Django where to put which content.

Django uses the {% block %} tag, to create placeholders:

master.html:

Templates that uses the master template, uses the {% block %} tag to create content that will be displayed in the placeholder with the same name:

template.html:


Run Example »
ArmenianEnglish