Display blog article on landing page

This commit is contained in:
2025-12-30 21:37:15 +01:00
parent 9baeb3736b
commit d6b4d64390
4 changed files with 65 additions and 3 deletions

View File

@@ -88,10 +88,22 @@ def login():
else:
flash(u"L'utilisateur n'existe pas", 'error')
else:
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
cursor = conn.cursor() # Création de l'objet "curseur"
cursor.execute("""SELECT title, subtitle, creation_date, last_updated, author FROM Blog_posts WHERE status='public_unified'""" )
list_posts=cursor.fetchall()
posts=list()
id=0
conn.close()
if list_posts != None:
for post in list_posts:
posts=[dict(title=post[0], subtitle=post[1], creation_date=post[2], last_updated=post[3], author=post[4])] + posts
resp = render_template('accueil.html',
server_title=SERVER_TITLE,
server_desc=SERVER_DESC,
mail_server=MAIL_SERVER,
list_posts=posts,
signin_enable=app.config['SIGNIN_ENABLE'])
return resp