diff options
| author | rebecca <ubq323@ubq323.website> | 2026-10-31 15:47:16 +0000 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-10-31 22:11:04 +0000 |
| commit | 70722694a255739a43a4d70988daf3f7b6bb6f9d (patch) | |
| tree | e7cc1bf6b7965db09c7d0f5ce7ce51befef979a0 | |
| parent | 67b4bc9e66645055d1d51cd6e60d23929268118b (diff) | |
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.
| -rw-r--r-- | apioforum/templates/delete_thread.html | 2 | ||||
| -rw-r--r-- | apioforum/thread.py | 2 |
2 files changed, 3 insertions, 1 deletions
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 %} <form method="post"> -<p>deleting thread created {{ts(thread.created)}} ago with {{post_count}} posts</p> +<p><span class="warning">permanently</span> deleting thread created {{ts(thread.created)}} ago with {{post_count}} posts</p> {% if post_count > 50 %} <p class="warning">thread contains more than 50 posts!</p> {% 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") |
