upload pdf added to template and form
This commit is contained in:
parent
e779a764b4
commit
452bf73b84
@ -31,7 +31,9 @@ class PublicationForm(FlaskForm):
|
||||
],
|
||||
)
|
||||
year = IntegerField(
|
||||
"Year:", [validators.InputRequired(), NumberRange(min=0, max=2050)]
|
||||
"Year:",
|
||||
[validators.InputRequired(), NumberRange(min=0, max=2050)],
|
||||
default=2023
|
||||
)
|
||||
fields = StringField("Fields:")
|
||||
type = StringField(
|
||||
@ -55,6 +57,10 @@ class PublicationForm(FlaskForm):
|
||||
"Image of the book:",
|
||||
validators=[FileAllowed(["jpg", "png", "gif"], "Images only!")],
|
||||
)
|
||||
pdf = FileField(
|
||||
"Pdf of the book:",
|
||||
validators=[FileAllowed(["pdf"], "Only pdf uploads supported")],
|
||||
)
|
||||
secret = StringField(
|
||||
"Librarians secret:",
|
||||
[
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<div id="nav" class="container">
|
||||
<button id="leftmostbtn"><a href="/">All books</a></button>
|
||||
<button id="leftmostbtn"><a href="/">Back to books</a></button>
|
||||
<button><a href="/upload">Upload</a></button>
|
||||
<div class="dropdown" style="visibility: hidden">
|
||||
<button id="Year" class="dropbtn">Year</button>
|
||||
@ -85,6 +85,14 @@
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fileupload-field">
|
||||
{{ uploadform.pdf.label }}
|
||||
{{ uploadform.pdf }}
|
||||
{% for message in uploadform.pdf.errors %}
|
||||
<div class="error">{{ message }}</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="uploadform-field">
|
||||
{{ uploadform.secret.label }}
|
||||
{{ uploadform.secret }}
|
||||
|
Loading…
Reference in New Issue
Block a user