diff --git a/README b/README index 2fc8583..57f4e65 100644 --- a/README +++ b/README @@ -1,7 +1,4 @@ -### TODO: get all this inside a docker container and use compose to do the whole set (pg, flask, ?) -https://docs.docker.com/compose/gettingstarted/ - - +########################################################### FOR local INSTALL: # flask -> python web server # sqlalchemy -> provides db-agnostic python objects of db content (and more) # flask-sqlachemy combines/wraps this to provide a db.* set of objects based on the 'app' that flask creates @@ -16,16 +13,23 @@ sudo apt install python3-pip python3-psycopg2 libpq-dev # --user sticks python libs in ~/.local/[bin|lib|share] pip3 install --user flask sqlalchemy flask-sqlalchemy flask-marshmallow SQLAlchemy-serializer flask-wtf flask-bootstrap marshmallow-sqlalchemy +########################################################### FOR local RUN: -# run the web server by: +# run a DEV version by: python3 main.py -### Remember: +### to make a new PROD copy.. +sudo docker-compose -f /srv/docker/config/docker-compose.yml stop bookdb_web +sudo docker-compose -f /srv/docker/config/docker-compose.yml rm bookdb_web +sudo docker-compose -f /srv/docker/config/docker-compose.yml build bookdb_web +sudo docker-compose -f /srv/docker/config/docker-compose.yml up bookdb_web + + +########################################################## Remember: MUST use form.errors when we have a validator that is fancier than not empty (year_published in book and num_books in series SO FAR) -#### TODOS (next 27): -TODO-08: show books on shelf list +########################################################### TODOS (next 27): TODO-09: show books to buy view / printable TODO-11: show unrated books (with toggle to exclude those with missing in a series) TODO-12: show books missing from a series (I own only some of them) diff --git a/main.py b/main.py index 9559e9c..d0c5b8b 100644 --- a/main.py +++ b/main.py @@ -644,6 +644,11 @@ def rem_parent_books_from_series(pid): st.SetMessage("Failed to delete parent & sub books from ALL series! -- {}".format( e.orig )) return jsonify(success=True) +@app.route("/books_on_shelf", methods=["GET"]) +def books_on_shelf(): + books = db.engine.execute("select * from book where id not in ( select sub_book_id from book_sub_book_link ) and owned = (select id from owned where name = 'Currently Owned')") + return render_template("books.html", books=books ) + @app.route("/", methods=["GET"]) def main_page(): return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage()) diff --git a/templates/base.html b/templates/base.html index ce560b1..c09e311 100644 --- a/templates/base.html +++ b/templates/base.html @@ -47,6 +47,7 @@