Chapter 8

This commit is contained in:
2023-06-04 01:17:48 +02:00
parent d81f038422
commit c91b89da5f
6 changed files with 44 additions and 19 deletions

View File

@@ -4,7 +4,8 @@
<img src="{{ post.author.avatar(36) }}" />
</td>
<td>
{{ post.author.username }} says:<br />{{ post.body }}
<a href="{{ url_for('user', username = post.author.username) }}">{{ post.author.username }}</a>
says:<br />{{ post.body }}
</td>
</tr>
</table>

View File

@@ -14,6 +14,7 @@
<a href="{{ url_for('login') }}">Login</a>
{% else %}
<a href="{{ url_for('user', username = current_user.username) }}">Profile</a>
<a href="{{ url_for('explore') }}">Explore</a>
<a href="{{ url_for('logout') }}">Logout</a>
{% endif %}
</div>

View File

@@ -2,11 +2,20 @@
{% block content %}
<h1>Hi, {{ current_user.username }}!</h1>
{% for post in posts %}
<div>
{% if form %}
<form action="" method="post">
{{ form.hidden_tag() }}
<p>
{{ post.author.username }} says: <b>{{ post.body }}</b>
{{ form.post.label }}<br />
{{ form.post(cols = 32, rows = 4) }}<br />
{% for error in form.post.errors %}
<span style="color: red;">[{{ error }}]</span>
{% endfor %}
</p>
</div>
<p>{{ form.submit() }}</p>
</form>
{% endif %}
{% for post in posts %}
{% include "_post.html" %}
{% endfor %}
{% endblock %}
{% endblock %}s