Skip to content
Justice Tech School

Template Inheritance

Base templates define blocks.

Example
<!-- base.html -->
<title>{% block title %}Site{% endblock %}</title>
{% block content %}{% endblock %}

<!-- page.html -->
{% extends "base.html" %}
{% block content %}<p>Hi</p>{% endblock %}

Exercise

Extend.

{%  "base.html" %}

Quiz Test

Where must extends appear?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.