4.6.3 Template for a List of Startup Objects
We can now create a template to list our startups. As shown in Example 4.42, create a new file /organizer/templates/organizer/startup_list.html
.
organizer/templates/organizer/startup_list.html
in 13ce1870d0
1 <h2>Startup List</h2> 2 <ul> 3 {% for startup in startup_list %} 4 <li> 5 <a href=""> 6 {{ startup.name }}</a> 7 </li> 8 {% empty %} 9 <li><em>No Startups Available</em></li> 10 {% endfor %} 11 </ul>
In Chapter 5, we pass a list of startups to the startup_list
template variable. The template iterates through the list using the for
template tag loop, making ...
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.