Chapter 24 · 10 min read
Snippet 3
Snippet 3
Read this template, which extends a base layout.
{% extends "blog/base.html" %}
{% block content %}
{% if posts %}
<ul>
{% for post in posts %}
<li class="{% if forloop.first %}latest{% endif %}">
{{ post.title|title }}: {{ post.body|truncatewords:5 }}
</li>
{% endfor %}
</ul>
{% else %}
<p>Nothing yet.</p>
{% endif %}
{% endblock %}
