From 70722694a255739a43a4d70988daf3f7b6bb6f9d Mon Sep 17 00:00:00 2001 From: rebecca Date: Sat, 31 Oct 2026 15:47:16 +0000 Subject: fix thread deletions thread deletions have been broken for a while, because we get a foreign key constraint error. add deletes to the other tables that reference thread so that this will work properly. --- apioforum/templates/delete_thread.html | 2 +- apioforum/thread.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apioforum/templates/delete_thread.html b/apioforum/templates/delete_thread.html index aaf1de3..c4069c9 100644 --- a/apioforum/templates/delete_thread.html +++ b/apioforum/templates/delete_thread.html @@ -7,7 +7,7 @@ {% block content %}
-

deleting thread created {{ts(thread.created)}} ago with {{post_count}} posts

+

permanently deleting thread created {{ts(thread.created)}} ago with {{post_count}} posts

{% if post_count > 50 %}

thread contains more than 50 posts!

{% endif %} diff --git a/apioforum/thread.py b/apioforum/thread.py index 59bf1c0..2457deb 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -312,6 +312,8 @@ def delete_thread(thread_id): return redirect(url_for("thread.view_thread",thread_id=thread_id)) if request.method == "POST": db.execute("DELETE FROM posts WHERE thread = ?",(thread_id,)) + db.execute("DELETE FROM thread_tags WHERE thread = ?",(thread_id,)) + db.execute("DELETE FROM read WHERE thread = ?",(thread_id,)) db.execute("DELETE FROM threads WHERE id = ?",(thread_id,)) db.commit() flash("thread deleted deletedly") -- cgit v1.2.3