Template inheritance allows you to build a base “skeleton” template that contains all the common elements of your site and defines blocks that child templates can override.
The extends tag is used to inherit template.
extends tag tells the template engine that this template “extends” another template.
When the template system evaluates this template, first it locates the parent let’s assume, “base.html”.
At that point, the template engine will notice the block tags in base.html and replace those blocks with the contents of the child template.
You can use as many levels of inheritance as needed.
If We use {% extends %} in a template, it must be the first template tag in that template. Template inheritance won’t work, otherwise.
More {% block %} tags in our base templates are better.
Child templates don’t have to define all parent blocks, so we can fill in reasonable defaults in a number of blocks, then only define the ones we need later.
We Can’t define multiple block tags with the same name in the same template.
If We need to get the content of the block from the parent template, the {{ block.super}} variable will do the trick.
.png?h=d6a655d139774e019e75ccf40c823e2a)