November 2015
Beginner to intermediate
840 pages
26h 30m
English
Create a new file /blog/templates/blog/post_list.html, as shown in Example 4.44. The variable we pass data to is named post_list.
Example 4.44: Project Code
blog/templates/blog/post_list.html in 597bfb94f4
1 {% for post in post_list %} 2 <article> 3 <header> 4 <h2> 5 <a href=""> 6 {{ post.title|title }}</a> 7 </h2> 8 <p> 9 Written on: 10 <time datetime="{{ post.pub_date|date:"Y-m-d" }}"> 11 {{ post.pub_date|date:"l, F j, Y" }} 12 </time> 13 </p> 14 </header> 15 <p> {{ post.text|truncatewords ...
Read now
Unlock full access