4.7 Using Template Inheritance for Design Consistency

Currently, should we use our templates, we would only be providing partial HTML. We do not provide open or close <html> tags, nor a <head>, or even a <body>. We have programmed only the content, and we have done so in anticipation of this section.

Typically, a website provides webpages with repeated code. To preserve the look and feel of the site, each webpage is similarly structured and styled. If we had programmed this in each template, it would mean that—should we desire a structure change—we would have to change code in each and every template. Instead, we can use a single structure and connect it to the templates we have already programmed, creating a single place to change site-wide ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.