mirror of
https://github.com/shouptech/flask-tutorial.git
synced 2026-02-03 07:29:42 +00:00
28 lines
772 B
HTML
28 lines
772 B
HTML
{% extends 'base.html' %}
|
|
|
|
{% block header %}
|
|
<h1>{% block title %}Posts{% endblock %}</h1>
|
|
{% if g.user %}
|
|
<a class="action" href="{{ url_for('blog.create') }}">New</a>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% for post in posts %}
|
|
<article class="post">
|
|
<header>
|
|
<div>
|
|
<h1>{{ post.title }}</h1>
|
|
<div class="about">by {{ post.user.username }} on {{ post.created.strftime('%Y-%m-%d') }}</div>
|
|
</div>
|
|
{% if g.user.id == post.user_id %}
|
|
<a class="action" href="{{ url_for('blog.update', id=post.id) }}">Edit</a>
|
|
{% endif %}
|
|
</header>
|
|
<p class="body">{{ post.body }}</p>
|
|
</article>
|
|
{% if not loop.last %}
|
|
<hr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock %}
|