completed TODOs 13, 14, 15, 16 - views of subsets of books. Added 2 new TODOs to enhance their output / make the views better

This commit is contained in:
2021-01-09 01:13:26 +11:00
parent a6211928df
commit cd7a77ff6b
5 changed files with 59 additions and 16 deletions

23
main.py
View File

@@ -666,10 +666,31 @@ def missing_books():
missing.append( cnt )
for b in bsl:
missing.remove( b.book_num )
# turn missing from array into string, and strip 0 and last char (the square brackets)
# turn missing from array into string, and strip 0 and last char (the square brackets)
books.append( { 'id': t.id, 'title': t.title, 'num_books': t.num_books, 'missing': str(missing)[1:-1] } )
return render_template("missing.html", books=books )
@app.route("/wishlist", methods=["GET"])
def wishlist():
books = Book.query.join(Owned).filter(Owned.name=='On Wish List').all()
return render_template("books.html", books=books )
@app.route("/needs_replacing", methods=["GET"])
def needs_replacing():
books = Book.query.join(Condition,Owned).filter(Condition.name=='Needs Replacing',Owned.name=='Currently Owned').all()
return render_template("books.html", books=books )
@app.route("/sold", methods=["GET"])
def sold_books():
books = Book.query.join(Owned).filter(Owned.name=='Sold').all()
return render_template("books.html", books=books )
@app.route("/poor_rating", methods=["GET"])
def poor_rating_books():
books = Book.query.join(Rating,Owned).filter(Rating.id>6,Rating.name!='Undefined',Owned.name=='Currently Owned').all()
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())