2020-12-21 19:26:12 +01:00
|
|
|
"""This is the main flask library page"""
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
import flask
|
|
|
|
from flask import render_template
|
|
|
|
|
2020-12-21 18:58:46 +01:00
|
|
|
from csvparser.csvparser import getpublications, gettypes, getyears
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
APP = flask.Flask(__name__, static_folder="static")
|
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/")
|
|
|
|
def index():
|
2020-12-21 19:26:12 +01:00
|
|
|
"""Main route, shows all the books and you can filter them, a bit"""
|
2020-12-21 18:41:55 +01:00
|
|
|
pubtypes = gettypes()
|
2020-12-21 18:58:46 +01:00
|
|
|
pubyears = getyears()
|
2020-12-21 18:41:55 +01:00
|
|
|
publicatons = getpublications()
|
2020-12-21 18:58:46 +01:00
|
|
|
template = render_template(
|
|
|
|
"index.html",
|
|
|
|
publications=publicatons,
|
|
|
|
pubtypes=pubtypes,
|
|
|
|
pubyears=pubyears
|
|
|
|
)
|
|
|
|
return template
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
|
2020-12-21 18:41:55 +01:00
|
|
|
@APP.route("/<publicationID>")
|
|
|
|
def show_book(publicationID):
|
2020-12-21 19:26:12 +01:00
|
|
|
"""route for a publication, still needs to be made"""
|
2020-12-11 16:54:09 +01:00
|
|
|
# parse csv, render template with full list.
|
2020-12-21 18:58:46 +01:00
|
|
|
return render_template("publication.html")
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/<publication>")
|
|
|
|
def upload_book(publication):
|
2020-12-21 19:26:12 +01:00
|
|
|
"""upload a new book, still needs to be made"""
|
2020-12-21 18:41:55 +01:00
|
|
|
return render_template("upload.html")
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
APP.debug = True
|
|
|
|
APP.run(port=5000)
|