4.7.3 Using the Generic Template in Our Tag List Template

We now have a site-wide template that provides the HTML structure we want and defines blocks for us to override. We now need to edit our site templates to inherit this generic template and override the blocks we’ve defined.

Let’s start with our Tag list template, found in /organizer/templates/organizer/tag_list.html. We first tell the template to inherit the generic template by using the extends template tag followed by the location of the file: {% extends "base.html" %}.

With the generic template inherited, we simply wrap the content we wrote previously with the block template tags. We should also take care to override the title block by coding {% block title %}{{ block.super }} - Tag ...

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.