moved to using a Get*ById() in condition, covertype, owned files and exposing them in jinja and using them in books.html to fix-up the fact those columns were now raw forein keys (ids)
This commit is contained in:
15
main.py
15
main.py
@@ -18,12 +18,17 @@ Bootstrap(app)
|
||||
from author import Author, AuthorForm, AuthorSchema
|
||||
from publisher import Publisher, PublisherForm, PublisherSchema, GetPublishers
|
||||
from genre import Genre, GenreForm, GenreSchema, GetGenres
|
||||
from condition import Condition, ConditionForm, ConditionSchema
|
||||
from covertype import Covertype, CovertypeForm, CovertypeSchema
|
||||
from owned import Owned, OwnedForm, OwnedSchema
|
||||
from condition import Condition, ConditionForm, ConditionSchema, GetConditionById
|
||||
from covertype import Covertype, CovertypeForm, CovertypeSchema, GetCovertypeById
|
||||
from owned import Owned, OwnedForm, OwnedSchema, GetOwnedById
|
||||
from rating import Rating, RatingForm, RatingSchema
|
||||
from loan import Loan, LoanForm, LoanSchema
|
||||
|
||||
# allow jinja2 to call this python function
|
||||
app.jinja_env.globals['GetCovertypeById'] = GetCovertypeById
|
||||
app.jinja_env.globals['GetOwnedById'] = GetOwnedById
|
||||
app.jinja_env.globals['GetConditionById'] = GetConditionById
|
||||
|
||||
####################################### CLASSES / DB model #######################################
|
||||
book_author_link = db.Table('book_author_link', db.Model.metadata,
|
||||
db.Column('book_id', db.Integer, db.ForeignKey('book.id')),
|
||||
@@ -127,7 +132,7 @@ def books():
|
||||
books[index].parent_id = row.book_id
|
||||
books[index].sub_book_num = row.sub_book_num
|
||||
|
||||
return render_template("books.html", books=books)
|
||||
return render_template("books.html", books=books )
|
||||
|
||||
@app.route("/books_for_loan/<id>", methods=["GET"])
|
||||
def books_for_loan(id):
|
||||
@@ -170,7 +175,7 @@ def book(id):
|
||||
book_form.process()
|
||||
genre_list = GetGenres()
|
||||
publisher_list = GetPublishers()
|
||||
return render_template("book.html", books=book_s, subs=sub_book, book_form=book_form, genre_list=genre_list, publisher_list=publisher_list )
|
||||
return render_template("book.html", books=book_s, subs=sub_book, book_form=book_form, genre_list=genre_list, publisher_list=publisher_list, covertype_list=covertypes )
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def main_page():
|
||||
|
||||
Reference in New Issue
Block a user