diff --git a/library/application/forms/borrowform.py b/library/application/forms/borrowform.py index 17c2cfa..d24492c 100644 --- a/library/application/forms/borrowform.py +++ b/library/application/forms/borrowform.py @@ -1,4 +1,3 @@ -"""Form object declaration.""" from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, validators from wtforms.validators import Length diff --git a/library/application/forms/forgotpasswordform.py b/library/application/forms/forgotpasswordform.py index 50db65e..1573aa9 100644 --- a/library/application/forms/forgotpasswordform.py +++ b/library/application/forms/forgotpasswordform.py @@ -1,4 +1,3 @@ -"""Forgotten password form to help user.""" from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, validators from wtforms.validators import Email, Length diff --git a/library/application/forms/image_uploadform.py b/library/application/forms/image_uploadform.py new file mode 100644 index 0000000..5f91ece --- /dev/null +++ b/library/application/forms/image_uploadform.py @@ -0,0 +1,14 @@ +from flask_wtf import FlaskForm +from flask_wtf.file import FileAllowed, FileField +from wtforms import ( + SubmitField, + validators, +) + +class ImageUploadForm(FlaskForm): + """Image upload form.""" + image = FileField( + "Image of the book:", + validators=[FileAllowed(["jpg", "png", "gif", "webp"], "Images only!")], + ) + submit = SubmitField("Submit") diff --git a/library/application/forms/pdf_uploadform.py b/library/application/forms/pdf_uploadform.py new file mode 100644 index 0000000..3748eb8 --- /dev/null +++ b/library/application/forms/pdf_uploadform.py @@ -0,0 +1,14 @@ +from flask_wtf import FlaskForm +from flask_wtf.file import FileAllowed, FileField +from wtforms import ( + SubmitField, + validators, +) + +class PdfUploadForm(FlaskForm): + """Pdf upload form.""" + pdf = FileField( + "Pdf of the book:", + validators=[FileAllowed(["pdf"], "Only pdf uploads supported")], + ) + submit = SubmitField("Submit") diff --git a/library/application/forms/publicationform.py b/library/application/forms/publicationform.py index b2b28d2..21c146e 100644 --- a/library/application/forms/publicationform.py +++ b/library/application/forms/publicationform.py @@ -1,4 +1,3 @@ -"""Form object declaration.""" from flask_wtf import FlaskForm from flask_wtf.file import FileAllowed, FileField from wtforms import ( @@ -66,11 +65,4 @@ class PublicationForm(FlaskForm): "Pdf of the book:", validators=[FileAllowed(["pdf"], "Only pdf uploads supported")], ) - secret = StringField( - "Librarians secret:", - [ - validators.InputRequired(), - Length(min=2, message="Fill in the secret to unlock to library."), - ], - ) submit = SubmitField("Submit")