From 0c21688c00b9467b2712f6f1b00af59f98854cda Mon Sep 17 00:00:00 2001 From: crunk Date: Sun, 26 Nov 2023 18:15:22 +0100 Subject: [PATCH] adding flexible title from settings file --- library/app.py | 1 + library/page.py | 5 +++-- library/templates/base.html | 4 ++-- library/templates/upload.html | 5 ----- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/library/app.py b/library/app.py index f1bdea3..d085193 100644 --- a/library/app.py +++ b/library/app.py @@ -22,6 +22,7 @@ def create_app(): APP.config["UPLOAD_FOLDER"] = "tmpupload" APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"] APP.config["IMAGE_FOLDER"] = "static/images" + APP.config["TITLE"] = settings["title"] scheduler = flask_apscheduler.APScheduler() scheduler.api_enabled = False scheduler.init_app(APP) diff --git a/library/page.py b/library/page.py index c2769cc..c73ac80 100644 --- a/library/page.py +++ b/library/page.py @@ -37,6 +37,7 @@ def index(): publicatons = csvparser.getpublications() template = render_template( "index.html", + title=APP.config["TITLE"], publications=publicatons, pubtypes=pubtypes, pubyears=pubyears, @@ -49,7 +50,7 @@ def index(): def upload(): """Upload route, a page to upload a book to the csv""" uploadform = PublicationForm() - csvparser = CsvParser(APP.config["libaryfilename"], APP.config[""]) + csvparser = CsvParser(APP.config["LIBRARY_FILENAME"], APP.config["IMAGE_FOLDER"]) if request.method == "POST": if uploadform.validate_on_submit() and checksecret( uploadform.secret.data @@ -59,7 +60,7 @@ def upload(): return redirect(str(id), code=303) else: return render_template("upload.html", uploadform=uploadform) - return render_template("upload.html", uploadform=uploadform) + return render_template("upload.html", title=APP.config["TITLE"], uploadform=uploadform) @APP.route("/", methods=["GET", "POST"]) diff --git a/library/templates/base.html b/library/templates/base.html index c7634e5..e45d3d4 100644 --- a/library/templates/base.html +++ b/library/templates/base.html @@ -3,7 +3,7 @@ - Library collection + {{title}} @@ -16,7 +16,7 @@
-

LIBRARY COLLECTION

+

{{title}}

{% block main %} {% endblock main %} diff --git a/library/templates/upload.html b/library/templates/upload.html index 209165c..bb32d74 100644 --- a/library/templates/upload.html +++ b/library/templates/upload.html @@ -72,11 +72,6 @@ {{ uploadform.license }} -
- {{ uploadform.licenseshort.label }} - {{ uploadform.licenseshort }} -
-
{{ uploadform.highlights.label }} {{ uploadform.highlights }}