From 469dfdd8923bc08f977483477f76c286cebfed9a Mon Sep 17 00:00:00 2001 From: crunk Date: Sun, 7 Mar 2021 19:55:47 +0100 Subject: [PATCH] WIP uploadform, Up next is the CSV writer --- __init.py__ | 0 library/csvparser/.~lock.varlib.csv# | 1 - library/page.py | 12 +++++ library/static/css/upload.css | 45 ++++++++++++++++ library/templates/base.html | 1 + library/templates/pastevents.html | 2 +- library/templates/upcomingevent.html | 4 +- library/templates/upload.html | 76 ++++++++++++++++++++++++++++ library/uploadform.py | 63 +++++++++++++++++++++++ requirements.txt | 5 +- 10 files changed, 204 insertions(+), 5 deletions(-) create mode 100644 __init.py__ delete mode 100644 library/csvparser/.~lock.varlib.csv# create mode 100644 library/static/css/upload.css create mode 100644 library/uploadform.py diff --git a/__init.py__ b/__init.py__ new file mode 100644 index 0000000..e69de29 diff --git a/library/csvparser/.~lock.varlib.csv# b/library/csvparser/.~lock.varlib.csv# deleted file mode 100644 index f0b7f7d..0000000 --- a/library/csvparser/.~lock.varlib.csv# +++ /dev/null @@ -1 +0,0 @@ -,shambler,caprice,14.02.2021 19:03,file:///home/shambler/.config/libreoffice/4; \ No newline at end of file diff --git a/library/page.py b/library/page.py index 630d4fd..eb2b3f8 100644 --- a/library/page.py +++ b/library/page.py @@ -7,6 +7,7 @@ from icalendar import Calendar import datetime from flask import render_template from rnrfeed.rnrfeeder import getevents, getlatestevent +from uploadform import PublicationForm from csvparser.csvparser import ( getlicenses, getpublications, @@ -14,8 +15,13 @@ from csvparser.csvparser import ( getyears, getfullpublication, ) +from flask_wtf.csrf import CSRFProtect + +csrf = CSRFProtect() APP = flask.Flask(__name__, static_folder="static") +APP.config['SECRET_KEY'] = 'ty4425hk54a21eee5719b9s9df7sdfklx' +csrf.init_app(APP) @APP.route("/") @@ -35,6 +41,12 @@ def index(): return template +@APP.route("/upload") +def upload(): + uploadform = PublicationForm() + return render_template("upload.html", uploadform=uploadform) + + @APP.route("/") def show_book(publicationID): """route for a publication, still needs to be made""" diff --git a/library/static/css/upload.css b/library/static/css/upload.css new file mode 100644 index 0000000..701f4f7 --- /dev/null +++ b/library/static/css/upload.css @@ -0,0 +1,45 @@ +#uploadform { + max-width: 60%; + margin-top: 3em; + margin-left: 1em; + margin-right: 1em; + padding: 1em; + z-index: 10; + border: 3px solid black; + background-color: #f1f1f1; + border-spacing: 0; + border-collapse: collapse; + clear: both; + position: relative; +} + +.uploadform-field { + margin: 0; + padding: 1em; +} + +input[type=text], select { + width: 100%; + padding: 1em 3em; + padding-left: 0.5em; + margin: 1em 0; + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} + +input[type=submit] { + background-color: #DD4F77; + text-align: right; + color: white; + padding: 1em 3em; + margin: 1em 1em; + border: none; + border-radius: 4px; + cursor: pointer; +} + +input[type=submit]:hover { + background-color: #404d81; +} diff --git a/library/templates/base.html b/library/templates/base.html index 95e5735..bb8dbba 100644 --- a/library/templates/base.html +++ b/library/templates/base.html @@ -6,6 +6,7 @@ +
diff --git a/library/templates/pastevents.html b/library/templates/pastevents.html index 038f1f2..73a77f5 100644 --- a/library/templates/pastevents.html +++ b/library/templates/pastevents.html @@ -9,7 +9,7 @@

{{ eventtitle }}

{{ text[0]|safe }}
-

For those interested in this read and repair event the physical library at varia offers the following books:

+

For those interested to learn more on the topics of this read and repair event the physical library at varia offers the following books: