add helper function GetGenreList - passes all genres to *.html, so horizontal "list" of checkboxes for book can be created
This commit is contained in:
7
main.py
7
main.py
@@ -2,7 +2,7 @@ from flask import Flask, render_template, request
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_marshmallow import Marshmallow
|
||||
from flask_bootstrap import Bootstrap
|
||||
from wtforms import SubmitField, StringField, HiddenField, SelectField, validators, Form
|
||||
from wtforms import SubmitField, StringField, HiddenField, SelectField, validators
|
||||
from flask_wtf import FlaskForm
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -17,7 +17,7 @@ Bootstrap(app)
|
||||
|
||||
from author import Author, AuthorForm, AuthorSchema
|
||||
from publisher import Publisher, PublisherForm, PublisherSchema
|
||||
from genre import Genre, GenreForm, GenreSchema
|
||||
from genre import Genre, GenreForm, GenreSchema, GetGenreList
|
||||
from condition import Condition, ConditionForm, ConditionSchema
|
||||
from covertype import Covertype, CovertypeForm, CovertypeSchema
|
||||
from owned import Owned, OwnedForm, OwnedSchema
|
||||
@@ -164,7 +164,8 @@ def book(id):
|
||||
book_form.owned.default = book.owned
|
||||
book_form.rating.default = book.rating
|
||||
book_form.process()
|
||||
return render_template("book.html", books=book_s, subs=sub_book, book_form=book_form )
|
||||
genre_list = GetGenreList()
|
||||
return render_template("book.html", books=book_s, subs=sub_book, book_form=book_form, genre_list=genre_list )
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def main_page():
|
||||
|
||||
Reference in New Issue
Block a user