Compare commits

...

2 Commits

Author SHA1 Message Date
a5a44351cd Merge branch 'main' of git.ingemanngade.net:NikolajDanger/UIS_Prototype 2022-05-26 12:55:57 +02:00
d0765c90f3 2022-05-26 12:51:32 +02:00

View File

@ -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]