This commit is contained in:
Patrick 2024-11-16 20:48:12 +01:00
parent b40d5a2ee4
commit 7b90fc2f3a
5 changed files with 22 additions and 7 deletions

View file

@ -58,8 +58,7 @@ article {
text-overflow: ellipsis;
}
.title,
.title_full {
.inline {
display: inline;
}

View file

@ -26,8 +26,8 @@ Licensed under the AGPL-3.0-or-later. See LICENSE for details.
<article>
<form id="form" action="/log_in" method="post">
<label for="textInput">Create your user:</label>
<input id="title_input" type="text" name="username" required>
<input id="title_input" type="text" name="password" required>
<input class="inline" type="text" name="username" required>
<input class="inline" type="password" name="password" required>
<input type="submit" value="Create Account / Log In">
</form>
</article>

View file

@ -27,7 +27,8 @@ Licensed under the AGPL-3.0-or-later. See LICENSE for details.
{% for post_id, title, user_id, description in posts %}
<a href="/view?post={{ post_id }}">
<div class="post">
<h3 class="title">{{ title }}</h3>
<h3 class="inline">{{ title }}</h3>
<p class="inline"> by {{ user_id }}</p>
<p class="description">{{ description }}</p>
</div>
</a>

View file

@ -25,8 +25,8 @@ Licensed under the AGPL-3.0-or-later. See LICENSE for details.
</header>
<article>
<div class="post">
<h3 class="title_full">{{ title }}</h3>
<p class="title_full"> by {{ user }}</p>
<h3 class="inline">{{ title }}</h3>
<p class="inline"> by {{ user }}</p>
<p class="description_full">{{ description }}</p>
</div>
</article>

View file

@ -40,6 +40,21 @@ def index():
status = "Log In"
else:
status = "Log Out"
for i in range(len(posts)):
cursor.execute(
"""
SELECT users.username
FROM posts
JOIN users ON posts.user_id = users.id
WHERE posts.id = ?
""",
(posts[i][2],),
)
username = cursor.fetchone()
if not username:
username = ("Unknown",)
posts[i] = (posts[i][0], posts[i][1], username[0], posts[i][3])
return render_template("index.html", posts=posts, status=status)