From cc8d8c30c1f1701cee380cf71569014f72a376cf Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Wed, 6 Jan 2021 23:31:19 +1100 Subject: [PATCH] removed debugs, reply with 200 OK instead of redirect that is ignored anyway --- README | 6 ++++-- main.py | 13 ++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README b/README index 95c0abe..30ea0fa 100644 --- a/README +++ b/README @@ -32,6 +32,9 @@ MAYBE-1: when moving a book in a series (which is part of 2 series), do we pop-u #### TODOS (next 22): TODO-5: should deleting really just ask if want to mark it as SOLD? +TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book) +TODO-22: adding a sub-book when the parent book is in a series, need to add a bsl for it and make it the next (probably) + TODO-8: show books on shelf list TODO-9: show books to buy view / printable TODO-11: show unrated books (with toggle to exclude those with missing in a series) @@ -47,7 +50,6 @@ TODO-18: consider which of the 'books maybe not valid' reports make sense still TODO-19: icons on wish list, etc.? (not sure I really want them, but if so) - wishlist: search-dollar OR https://www.flaticon.com/free-icon/wishlist_868517 - save: https://www.flaticon.com/free-icon/sold_463255?term=sold&page=1&position=6&related_item_id=463255 + TODO-20: ORM all books load is slow - should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....) -TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book) -TODO-22: adding a sub-book when the parent book is in a series, need to add a bsl for it and make it the next (probably) diff --git a/main.py b/main.py index 360ff0a..e52e134 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, request, redirect +from flask import Flask, render_template, request, redirect, jsonify from flask_sqlalchemy import SQLAlchemy from sqlalchemy.exc import SQLAlchemyError from flask_marshmallow import Marshmallow @@ -588,9 +588,7 @@ def rem_books_from_loan(id): except SQLAlchemyError as e: st.SetAlert("danger") st.SetMessage("Failed to remove books from loan! -- {}".format( e.orig )) - - print ("NOT SURE WHAT TO DO if we dont want output" ) - return redirect("/loan/{}".format(id)) + return jsonify(success=True) @app.route("/add_books_to_loan/", methods=["POST"]) def add_books_to_loan(id): @@ -603,9 +601,7 @@ def add_books_to_loan(id): except SQLAlchemyError as e: st.SetAlert("danger") st.SetMessage("Failed to add books to loan! -- {}".format( e.orig )) - - print ("NOT SURE WHAT TO DO if we dont want output" ) - return redirect("/loan/{}".format(id)) + return jsonify(success=True) @app.route("/rem_parent_books_from_series/", methods=["POST"]) def rem_parent_books_from_series(pid): @@ -617,8 +613,7 @@ def rem_parent_books_from_series(pid): except SQLAlchemyError as e: st.SetAlert("danger") st.SetMessage("Failed to delete parent & sub books from ALL series! -- {}".format( e.orig )) - print ("NOT SURE WHAT TO DO if we dont want output - can we just return a 200?" ) - return redirect("/") + return jsonify(success=True) @app.route("/", methods=["GET"]) def main_page():