new sortable list implementation

This commit is contained in:
2025-12-19 19:01:01 +03:00
parent 98bf430604
commit 46704df7d9
16 changed files with 581 additions and 395 deletions

View File

@@ -29,8 +29,10 @@ def sort_topics():
@bp.post("/sort-topics")
def sort_topics_post():
topics_list = request.form.getlist('topics[]')
print(topics_list)
with db.transaction():
for topic_id, new_order in request.form.items():
for new_order, topic_id in enumerate(topics_list):
db.execute("UPDATE topics SET sort_order = ? WHERE id = ?", new_order, topic_id)
return redirect(url_for(".sort_topics"))