November 2015
Beginner to intermediate
840 pages
26h 30m
English
FlatPage ObjectsNow that we have a FlatPage instance, we need to be able to link to it. While we know that URL reversal works, it’s not entirely obvious how to get the information into our webpages.
The flatpages app works by providing us with a custom template tag. These tags extend the basic operation of the template and allow for all sorts of new behavior. We will build our own template tags in Chapter 27: Building Custom Template Tags.
To use a custom template tag, we must first load the custom tags. Then we can call get_flatpages and set all of the FlatPage objects as the flatpage_list variable, as shown in Example 15.23.
Example 15.23: Project Code
templates/base.html in 4b8bef1bdb
1 {% ...
Read now
Unlock full access