✨
This commit is contained in:
@ -55,11 +55,13 @@ class Post(tuple):
|
||||
def __init__(self, post_data):
|
||||
self.post_id = post_data[0]
|
||||
self.group_id = post_data[1]
|
||||
self.group_name = ""
|
||||
self.author_id = post_data[2]
|
||||
self.author = ""
|
||||
self.author_name = ""
|
||||
self.title = post_data[3]
|
||||
self.content = post_data[4]
|
||||
self.created_date = post_data[5]
|
||||
self._get_group_name()
|
||||
self._get_author_name()
|
||||
super().__init__()
|
||||
|
||||
@ -69,7 +71,15 @@ class Post(tuple):
|
||||
SELECT first_name, last_name FROM users WHERE user_id = %s
|
||||
"""
|
||||
cur.execute(sql_call, (self.author_id,))
|
||||
self.author = ' '.join(cur.fetchone())
|
||||
self.author_name = ' '.join(cur.fetchone())
|
||||
|
||||
def _get_group_name(self):
|
||||
cur = conn.cursor()
|
||||
sql_call = """
|
||||
SELECT name FROM groups WHERE group_id = %s
|
||||
"""
|
||||
cur.execute(sql_call, (self.group_id,))
|
||||
self.group_name = cur.fetchone()[0]
|
||||
|
||||
class Thread(tuple):
|
||||
def __init__(self, thread_data):
|
||||
|
@ -13,6 +13,13 @@ h1, h2, h3, h4, h5, h6 {
|
||||
margin-bottom: 120px;
|
||||
}
|
||||
|
||||
.group-name {
|
||||
position: relative;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
|
@ -8,11 +8,14 @@
|
||||
<article class="media content-section">
|
||||
<div class="media-body">
|
||||
<div class="article-metadata">
|
||||
<a class="mr-2" href="#">{{ post.author }}</a>
|
||||
<a class="mr-2" href="#">{{ post.author_name }}</a>
|
||||
<small class="text-muted">{{ post.date_posted }}</small>
|
||||
</div>
|
||||
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
|
||||
<p class="article-content">{{ post.content }}</p>
|
||||
<div class="group-name" >
|
||||
<a href="#">{{ post.group_name }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user