O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Example 4.27: Project Code

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required