Grokking Django
Vote

0% completed

​

Template Inheritance for Reusability

What happens to a site's navigation menu when every page carries its own copy of it? Adding one link means editing every template, and a page that is missed shows an old menu. The blog app already has a home page, an article list and an About page, and each of them needs the same header, menu and footer.

Django solves this with template inheritance. One base template holds the parts that every page shares and marks the places where pages differ. Each page is a child template that names the base template and supplies only its own content for those places

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content