user_post.html (1431B) download
1{% extends "layout.html" %}
2{% block content %}
3 <h1 class="mb-3">Posts by {{ user.username }} ({{ posts.total }})</h1>
4 {% for post in posts.items %}
5 <article class="media content-section">
6 <img class="rounded-circle article-img" src="{{ url_for('static', filename='profile_pics/' + post.author.image_file) }}">
7 <div class="media-body">
8 <div class="article-metadata">
9 <a class="mr-2" href="{{ url_for('user_posts', username=post.author.username)}}">{{ post.author.username }}</a>
10 <small class="text-muted">{{ post.date_posted.strftime('%Y-%m-%d') }}</small>
11 </div>
12 <h2><a class="article-title" href="{{ url_for('post', post_id=post.id) }}">{{ post.title }}</a></h2>
13 <p class="article-content">{{ post.content }}</p>
14 </div>
15 </article>
16 {% endfor %}
17 {% for page_num in posts.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
18 {% if page_num %}
19 {% if posts.page == page_num%}
20 <a class="btn btn-info mb-4"href="{{url_for('user_posts', username=user.username, page=page_num)}}">{{page_num}}</a>
21 {% else %}
22 <a class="btn btn-outline-info mb-4" href="{{url_for('user_posts', username=user.username, page=page_num)}}">{{page_num}}</a>
23 {% endif %}
24 {% else %}
25 ...
26 {% endif %}
27 {% endfor %}
28{% endblock content %}