generating shit
This commit is contained in:
parent
5d32cbaec5
commit
2a81116db6
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
*.db
|
||||||
__pycache__
|
__pycache__
|
||||||
|
generated
|
||||||
metadatum
|
metadatum
|
||||||
venv
|
venv
|
||||||
|
3
Makefile
3
Makefile
@ -1,4 +1,5 @@
|
|||||||
default: run
|
default: run
|
||||||
|
|
||||||
run:
|
run:
|
||||||
FLASK_ENV=development FLASK_APP=app flask run
|
@mkdir -p metadatum generated && \
|
||||||
|
FLASK_ENV=development FLASK_APP=app flask run
|
||||||
|
24
app.py
24
app.py
@ -5,6 +5,7 @@ from flask import Flask, redirect, render_template, url_for
|
|||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from flask_wtf.csrf import CSRFProtect
|
from flask_wtf.csrf import CSRFProtect
|
||||||
from flask_wtf.file import FileAllowed, FileField, FileRequired
|
from flask_wtf.file import FileAllowed, FileField, FileRequired
|
||||||
|
from temp_index import make_cards
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
from wtforms import RadioField, StringField
|
from wtforms import RadioField, StringField
|
||||||
from wtforms.validators import DataRequired
|
from wtforms.validators import DataRequired
|
||||||
@ -46,19 +47,14 @@ def upload():
|
|||||||
if upload_form.validate_on_submit():
|
if upload_form.validate_on_submit():
|
||||||
f = upload_form.metadata.data
|
f = upload_form.metadata.data
|
||||||
filename = secure_filename(f.filename)
|
filename = secure_filename(f.filename)
|
||||||
f.save(os.path.join(CWD, "metadatum", filename))
|
metadata_fpath = os.path.join(CWD, "metadatum", filename)
|
||||||
return redirect(url_for("home"))
|
f.save(metadata_fpath)
|
||||||
|
|
||||||
return render_template("index.html", upload_form=upload_form)
|
pdf = os.path.join(CWD, "generated", "test.pdf")
|
||||||
|
metadata = "sqlite:///{}".format(os.path.join(CWD, "metadatum", filename))
|
||||||
|
make_cards(
|
||||||
@app.route("/generate", methods=["POST"])
|
pdf, metadata, ["title", "timestamp", "comments", "authors"], ["tags"]
|
||||||
def generate():
|
)
|
||||||
upload_form = UploadForm()
|
return render_template("index.html", upload_form=upload_form, pdf=pdf)
|
||||||
|
|
||||||
if upload_form.validate_on_submit():
|
|
||||||
# pass some sort of condition to render_template to sort out the frame
|
|
||||||
# render
|
|
||||||
pass
|
|
||||||
|
|
||||||
return render_template("index.html", upload_form=upload_form)
|
return render_template("index.html", upload_form=upload_form)
|
||||||
|
@ -40,5 +40,10 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{% if pdf %}
|
||||||
|
<p> FOOOO </p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user