You can use as many levels of inheritance as needed. One common way of using inheritance is the following three-level approach:
- Create a base.html template that holds the main look and feel of your site. This is the stuff that rarely, if ever, changes.
- Create a base_SECTION.html template for each “section” of your site (e.g., base_photos.html andbase_forum.html). These templates extend base.html and include section-specific styles/design.
- Create individual templates for each type of page, such as a forum page or a photo gallery. These templates extend the appropriate section template.
This approach maximizes code reuse and makes it easy to add items to shared areas, such as section-wide navigation.
No comments:
Post a Comment