[user_stream.html]

{% extends "stream.html" %}

{% block content %}
<div class="row">
    <div class="grid-25">
        <h1>{{ user.username }}</h1>
    </div>
    <div class="grid-50">
        <div class="grid-33">
            <h5>Posts</h5>
            <p>{{ user.posts.count() }}</p>
        </div>
        <div class="grid-33">
            <h5>Followers</h5>
            <p>0</p>
        </div>
        <div class="grid-33">
            <h5>Following</h5>
            <p>0</p>
        </div>
    </div>
    <div class="grid-25">
        <!-- Follow/unfollow button -->
    </div>
</div>

{{ super() }}
{% endblock %}


{% extends “stream.html” %}

The user_stream.html template’s task is to display the user’s meta info. The posts are listed by inheriting the stream.html template using {{ super() }}, that’s DRY programming!

.count()
Python function that returns the number of items in a list, in our case; records in a query.