|
|
@ -5,6 +5,7 @@ from flask import Flask, redirect, render_template, url_for |
|
|
|
from flask_wtf import FlaskForm |
|
|
|
from flask_wtf.csrf import CSRFProtect |
|
|
|
from flask_wtf.file import FileAllowed, FileField, FileRequired |
|
|
|
from temp_index import make_cards |
|
|
|
from werkzeug.utils import secure_filename |
|
|
|
from wtforms import RadioField, StringField |
|
|
|
from wtforms.validators import DataRequired |
|
|
@ -46,19 +47,14 @@ def upload(): |
|
|
|
if upload_form.validate_on_submit(): |
|
|
|
f = upload_form.metadata.data |
|
|
|
filename = secure_filename(f.filename) |
|
|
|
f.save(os.path.join(CWD, "metadatum", filename)) |
|
|
|
return redirect(url_for("home")) |
|
|
|
|
|
|
|
return render_template("index.html", upload_form=upload_form) |
|
|
|
|
|
|
|
|
|
|
|
@app.route("/generate", methods=["POST"]) |
|
|
|
def generate(): |
|
|
|
upload_form = UploadForm() |
|
|
|
|
|
|
|
if upload_form.validate_on_submit(): |
|
|
|
# pass some sort of condition to render_template to sort out the frame |
|
|
|
# render |
|
|
|
pass |
|
|
|
metadata_fpath = os.path.join(CWD, "metadatum", filename) |
|
|
|
f.save(metadata_fpath) |
|
|
|
|
|
|
|
pdf = os.path.join(CWD, "generated", "test.pdf") |
|
|
|
metadata = "sqlite:///{}".format(os.path.join(CWD, "metadatum", filename)) |
|
|
|
make_cards( |
|
|
|
pdf, metadata, ["title", "timestamp", "comments", "authors"], ["tags"] |
|
|
|
) |
|
|
|
return render_template("index.html", upload_form=upload_form, pdf=pdf) |
|
|
|
|
|
|
|
return render_template("index.html", upload_form=upload_form) |
|
|
|