Fiks opslags rækkefølge og dato format

This commit is contained in:
Mikkel
2022-05-31 16:44:25 +02:00
parent b21a9c71a1
commit 5ecfe3b836
3 changed files with 4 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class Group(tuple):
sql_call = """
SELECT * FROM posts
WHERE group_id = %s
ORDER BY created_date DESC
"""
cur.execute(sql_call, (self.group_id,))
Posts = cur.fetchall()
@ -293,6 +294,7 @@ def get_posts_for_user(user_id):
SELECT group_id FROM users_groups
WHERE user_id = %s
)
ORDER BY created_date DESC
"""
cur.execute(sql_call, (user_id,))
user = [Post(i) for i in cur.fetchmany(50)] if cur.rowcount > 0 else []

View File

@ -10,7 +10,7 @@
<div class="media-body">
<div class="article-metadata">
<a class="mr-2 author-name" href="#">{{ post.author.first_name }} {{ post.author.last_name }} </a>
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%I %d-%m-%Y')}}</small>
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%M %d-%m-%Y')}}</small>
</div>
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
<p class="article-content">{{ post.content }}</p>

View File

@ -9,7 +9,7 @@
<div class="media-body">
<div class="article-metadata">
<a class="mr-2 author-name" href="#">{{ post.author.first_name }} {{ post.author.last_name }}</a>
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%I %d-%m-%Y')}}</small>
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%M %d-%m-%Y')}}</small>
</div>
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
<p class="article-content">{{ post.content }}</p>