completed -- TODO-08: show books on shelf list, and clarified install instructions for README

This commit is contained in:
2021-01-08 22:29:27 +11:00
parent 890b2cdc4e
commit d153c40c17
3 changed files with 18 additions and 8 deletions

20
README
View File

@@ -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)

View File

@@ -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())

View File

@@ -47,6 +47,7 @@
<div class="dropdown-menu" aria-labelledby="BookMenu">
<a class="dropdown-item" href="{{url_for('new_book')}}">Create</a>
<a class="dropdown-item" href="{{url_for('books')}}">Show All</a>
<a class="dropdown-item" href="{{url_for('books_on_shelf')}}">Show Books on shelf</a>
<a class="dropdown-item" href="{{url_for('stats')}}">Show Stats</a>
</div>
</div class="nav-item dropdown">