August 2016
Beginner to intermediate
717 pages
15h 24m
English
The legacy of templates allows you to define a super template and a subtemplate that inherits from the super template. In the super template, it is possible to define blocks that subtemplates can fill. This method allows us to respect the DRY philosophy by applying the common code to several templates in a super template. We will use an example where the index.html template will extend the base.html template.
The following is the base.html template code, which we must create in the template folder:
<html>
<head>
<title>
{ block title_html %}{% endblock %}
</title>
</head>
<body>
<h1>
Tasks Manager - {% block h1 %}{% endblock %}
</h1>
<article>
{% block article_content %}{% endblock %}
</article>
</body>
</html>In the previous ...
Read now
Unlock full access