|
|
|
"""Form object declaration."""
|
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import (
|
|
|
|
StringField,
|
|
|
|
IntegerField,
|
|
|
|
TextField,
|
|
|
|
RadioField,
|
|
|
|
SubmitField,
|
|
|
|
)
|
|
|
|
from wtforms import validators
|
|
|
|
from wtforms.validators import (
|
|
|
|
Length,
|
|
|
|
NumberRange,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class PublicationForm(FlaskForm):
|
|
|
|
"""Publication upload form."""
|
|
|
|
|
|
|
|
uploadpublication = StringField(
|
|
|
|
"Title of the publication:",
|
|
|
|
[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Length(
|
|
|
|
min=3, message="A publication in the library needs a title."
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
author = StringField(
|
|
|
|
"The author or editor:",
|
|
|
|
[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Length(
|
|
|
|
min=3,
|
|
|
|
message=(
|
|
|
|
"If the author or editor is not known just type unkown."
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
year = IntegerField(
|
|
|
|
"Year:", [validators.InputRequired(), NumberRange(min=0, max=2050)]
|
|
|
|
)
|
|
|
|
custodian = StringField("Custodian:")
|
|
|
|
fields = StringField("Fields:")
|
|
|
|
type = StringField(
|
|
|
|
"Type of publication:",
|
|
|
|
[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Length(
|
|
|
|
min=3,
|
|
|
|
message=(
|
|
|
|
"Here you can use terms such as zine, paperback,"
|
|
|
|
" hardcover."
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
publishers = StringField("Publishers:")
|
|
|
|
license = StringField("License:")
|
|
|
|
licenseshort = RadioField(
|
|
|
|
"Select the closest license type:",
|
|
|
|
choices=[
|
|
|
|
("Anti-copyright", "Anti-copyright"),
|
|
|
|
("No License Mentioned", "No License Mentioned"),
|
|
|
|
("Free Art License", "Free Art License"),
|
|
|
|
("Copyright", "Copyright"),
|
|
|
|
("Copyleft", "Copyleft"),
|
|
|
|
("Creative Commons", "Creative Commons"),
|
|
|
|
("Public Domain", "Public Domain"),
|
|
|
|
(
|
|
|
|
"GNU Free Documentation License",
|
|
|
|
"GNU Free Documentation License",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
highlights = TextField("Highlights from the publication:")
|
|
|
|
comments = TextField("Comments on the publication:")
|
|
|
|
borrowed = StringField("Currently borrowed by:")
|
|
|
|
secret = StringField(
|
|
|
|
"Librarians secret:",
|
|
|
|
[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Length(
|
|
|
|
min=2, message="Fill in the secret to unlock to library."
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
submit = SubmitField("Submit")
|