✨
This commit is contained in:
@ -56,11 +56,21 @@ class Post(tuple):
|
||||
self.post_id = post_data[0]
|
||||
self.group_id = post_data[1]
|
||||
self.author_id = post_data[2]
|
||||
self.author = ""
|
||||
self.title = post_data[3]
|
||||
self.content = post_data[4]
|
||||
self.created_date = post_data[5]
|
||||
self._get_author_name()
|
||||
super().__init__()
|
||||
|
||||
def _get_author_name(self):
|
||||
cur = conn.cursor()
|
||||
sql_call = """
|
||||
SELECT first_name, last_name FROM users WHERE user_id = %s
|
||||
"""
|
||||
cur.execute(sql_call, (self.author_id,))
|
||||
self.author = ' '.join(cur.fetchone())
|
||||
|
||||
class Thread(tuple):
|
||||
def __init__(self, thread_data):
|
||||
self.thread_id = thread_data[0]
|
||||
|
Reference in New Issue
Block a user