|
@ -18,7 +18,9 @@ CWD = Path().resolve() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UploadForm(FlaskForm): |
|
|
class UploadForm(FlaskForm): |
|
|
pdf = FileField(validators=[FileAllowed(["pdf"], "PDFs only!"), FileRequired()]) |
|
|
metadata = FileField( |
|
|
|
|
|
validators=[FileAllowed(["db"], "Metadata databases only"), FileRequired()] |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CardSidesForm(FlaskForm): |
|
|
class CardSidesForm(FlaskForm): |
|
@ -40,9 +42,9 @@ def upload(): |
|
|
card_sides_form = CardSidesForm() |
|
|
card_sides_form = CardSidesForm() |
|
|
|
|
|
|
|
|
if upload_form.validate_on_submit(): |
|
|
if upload_form.validate_on_submit(): |
|
|
f = upload_form.pdf.data |
|
|
f = upload_form.metadata.data |
|
|
filename = secure_filename(f.filename) |
|
|
filename = secure_filename(f.filename) |
|
|
f.save(os.path.join(CWD, "pdfs", filename)) |
|
|
f.save(os.path.join(CWD, "metadatum", filename)) |
|
|
return redirect(url_for("home")) |
|
|
return redirect(url_for("home")) |
|
|
return render_template( |
|
|
return render_template( |
|
|
"index.html", upload_form=upload_form, card_sides_form=card_sides_form |
|
|
"index.html", upload_form=upload_form, card_sides_form=card_sides_form |
|
|