2022-01-05 18:14:45 +01:00
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from flask_wtf.file import FileField, FileAllowed
|
|
|
|
from wtforms import validators
|
|
|
|
from wtforms.validators import Length
|
|
|
|
from wtforms import (
|
|
|
|
SubmitField,
|
|
|
|
StringField,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class UploadForm(FlaskForm):
|
|
|
|
"""File upload class for a new site in distribusi-verse"""
|
2022-01-07 16:55:40 +01:00
|
|
|
|
2022-01-05 18:14:45 +01:00
|
|
|
sitename = StringField(
|
|
|
|
"Name of your website:",
|
|
|
|
validators=[validators.InputRequired(), Length(6, 100)],
|
|
|
|
)
|
|
|
|
zipfile = FileField(
|
2022-01-07 16:55:40 +01:00
|
|
|
"Upload your zip file with content here:",
|
|
|
|
validators=[FileAllowed(["zip"], "Zip archives only!")],
|
2022-01-05 18:14:45 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
submit = SubmitField("Upload")
|