required forms
This commit is contained in:
parent
b499fea9cf
commit
fd3ee119fb
@ -1,4 +1,3 @@
|
||||
"""Form object declaration."""
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField, validators
|
||||
from wtforms.validators import Length
|
||||
|
@ -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
|
||||
|
14
library/application/forms/image_uploadform.py
Normal file
14
library/application/forms/image_uploadform.py
Normal file
@ -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")
|
14
library/application/forms/pdf_uploadform.py
Normal file
14
library/application/forms/pdf_uploadform.py
Normal file
@ -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")
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user