7. Inheriting Templates

As your applications grow larger, planning them becomes more important. For instance, you may have a Web application of a hundred pages and want to preserve a uniform look and feel across all those pages.

Template inheritance to the rescue! Django lets one template inherit from another, enabling you to easily create a consistent look for your pages—great for company Web sites or any Web site with more than just a few pages. For example, you may want to present a navigation bar at the bottom of all your Web pages and also a copyright notice. You may want to display a menu at the top of all pages and some company information, too. You can do all that easily with template inheritance.

To use template inheritance, you create ...

Get Django: Visual QuickPro Guide 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.