From 450fe88faa1b65297331f8c1e8816363ee59ed06 Mon Sep 17 00:00:00 2001 From: kitoy Date: Thu, 6 Jul 2023 05:52:10 +0200 Subject: [PATCH] =?UTF-8?q?Corrections=20=C3=A9ditions=20des=20posts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/blog.html | 2 +- templates/postedit.html | 33 ++++++++++++++++++--------------- views/blog.py | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/templates/blog.html b/templates/blog.html index 25a7026..16fd4c1 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -21,7 +21,7 @@

-
+
Privé
diff --git a/templates/postedit.html b/templates/postedit.html index a07bd80..9212b88 100644 --- a/templates/postedit.html +++ b/templates/postedit.html @@ -1,33 +1,36 @@ {% extends 'up_squelette.html' %} -{% include '_nav_userlogin.html' %} - {% block main %}
-
Vous pouvez modifier votre article. Actuellement seule la date de première édition sera publiée. Prochainement : intégration des edit'time dans la base de donnée.
-

- +
-
-

-
-
Privé
-
-
Public
-
-
+
+
+ {% if oldpost[2] == 'public' %} +
+

Privé
+
+

Public
+
+ {% else %} +
+

Privé
+
+

Public
+
+ {% endif %} +

-

-
+
{% endblock %} diff --git a/views/blog.py b/views/blog.py index 5eb1833..89f885a 100644 --- a/views/blog.py +++ b/views/blog.py @@ -99,7 +99,7 @@ def edit(title, time): else: conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée cursor = conn.cursor() # Création de l'objet "curseur" - cursor.execute("""SELECT title, content FROM posts WHERE title=? AND time =?""", (title, time)) + cursor.execute("""SELECT title, content, status FROM posts WHERE title=? AND time =?""", (title, time)) oldpost = cursor.fetchone() conn.close() return render_template('postedit.html',