completed -- TODO-08: show books on shelf list, and clarified install instructions for README
This commit is contained in:
20
README
20
README
@@ -1,7 +1,4 @@
|
|||||||
### TODO: get all this inside a docker container and use compose to do the whole set (pg, flask, ?)
|
########################################################### FOR local INSTALL:
|
||||||
https://docs.docker.com/compose/gettingstarted/
|
|
||||||
|
|
||||||
|
|
||||||
# flask -> python web server
|
# flask -> python web server
|
||||||
# sqlalchemy -> provides db-agnostic python objects of db content (and more)
|
# 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
|
# 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]
|
# --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
|
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
|
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)
|
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):
|
########################################################### TODOS (next 27):
|
||||||
TODO-08: show books on shelf list
|
|
||||||
TODO-09: show books to buy view / printable
|
TODO-09: show books to buy view / printable
|
||||||
TODO-11: show unrated books (with toggle to exclude those with missing in a series)
|
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)
|
TODO-12: show books missing from a series (I own only some of them)
|
||||||
|
|||||||
5
main.py
5
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 ))
|
st.SetMessage("Failed to delete parent & sub books from ALL series! -- {}".format( e.orig ))
|
||||||
return jsonify(success=True)
|
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"])
|
@app.route("/", methods=["GET"])
|
||||||
def main_page():
|
def main_page():
|
||||||
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
return render_template("base.html", alert=st.GetAlert(), message=st.GetMessage())
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
<div class="dropdown-menu" aria-labelledby="BookMenu">
|
<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('new_book')}}">Create</a>
|
||||||
<a class="dropdown-item" href="{{url_for('books')}}">Show All</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>
|
<a class="dropdown-item" href="{{url_for('stats')}}">Show Stats</a>
|
||||||
</div>
|
</div>
|
||||||
</div class="nav-item dropdown">
|
</div class="nav-item dropdown">
|
||||||
|
|||||||
Reference in New Issue
Block a user