15.4.1 Creating a Template
Before we get started, a quick look at the documentation will tell us that the flatpage app expects a template to display the FlatPage
instances with a title
field and a content
field. We first create the template namespace necessary for the flatpage templates, as shown in Example 15.5.
mkdir -p templates/flatpages
We can then create the templates/flatpages/default.html
using the code shown in Example 15.6.
templates/flatpages/default.html
in 75c781118d
1 {% extends parent_template|default:"base.html" %} 2 3 {% block title %} 4 {{ block.super }} - {{ flatpage.title }} 5 {% endblock %} 6 7 {% block content %} 8 <div> ...
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.