modified: templates/blog.html

modified:   templates/board.html
	modified:   templates/profil.html
	modified:   templates/up_up.html
	modified:   views/blog.py
	modified:   views/profil.py
This commit is contained in:
kitoy
2022-08-07 08:32:21 +02:00
parent aef308e3fd
commit 3451259a57
6 changed files with 17 additions and 38 deletions

View File

@@ -32,7 +32,7 @@ def racine_blog():
UTILISATEUR='%s'% escape(session['username'])
if request.method == 'POST':
title= request.form['title']
content = markdown(request.form['content'])
content = request.form['content']
#category = request.form['category']
status = request.form['status']
TIME=time.strftime("%A %d %B %Y %H:%M:%S")
@@ -55,6 +55,8 @@ def racine_blog():
status=row[4], avatar=row[5], nom=row[6], prenom=row[7], age=row[8])
for row in reversed(cursor.fetchall())]
conn.close()
for post in posts:
post['content'] = markdown(post['content'])
return render_template('blog.html', section='Post-it', posts=posts)
else:
return redirect(BASE_URL, code=401)
@@ -78,7 +80,7 @@ def edit(post):
if 'username' in session :
if request.method == 'POST' :
newtitle = request.form['title']
newcontent = markdown(request.form['content'])
newcontent = request.form['content']
newstatus = request.form['status']
conn = sqlite3.connect(DATABASE)
cursor = conn.cursor()
@@ -105,11 +107,13 @@ def viewsheet():
if 'username' in session:
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
cursor = conn.cursor() # Création de l'objet "curseur"
cursor.execute("""SELECT title, content, time, author, status, avatar, nom, prenom, age FROM posts INNER JOIN users ON author = name""")
cursor.execute("""SELECT title, content, time, author, status, avatar, nom, prenom, age FROM posts INNER JOIN users where status='public' """)
posts = [dict(title=row[0], content=row[1], time=row[2], author=row[3],
status=row[4], avatar=row[5], nom=row[6], prenom=row[7], age=row[8])
for row in reversed(cursor.fetchall())]
conn.close()
for post in posts:
post['content'] = markdown(post['content'])
return render_template('board.html', section='Post-it', posts=posts)
else:
return redirect(BASE_URL, code=401)