4.6.1 Template for a List of Tag
objects
Create a new template at /organizer/templates/organizer/tag_list.html
. In Example 4.27, as you may have guessed from the file name, we will list all of our Tag
objects. In Chapter 5, we will put a list of tags to the tag_list
variable.
organizer/templates/organizer/tag_list.html
in b4fb40ec0c
1 <h2>Tag List</h2> 2 <ul> 3 {% for tag in tag_list %} 4 <li> 5 <a href=""> 6 {{ tag.name|title }}</a> 7 </li> 8 {% endfor %} 9 </ul>
As before, we use a for
loop to iterate through the tag_list
that we assume the template is provided with. This loop gives us access to a tag
object, which we print ...
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.