distribusi-verse/verse/forms/editorform.py

36 lines
941 B
Python
Raw Normal View History

"""Form to save your CSS editor work."""
from wtforms import (
StringField,
TextAreaField,
2022-03-08 22:58:05 +01:00
BooleanField,
SubmitField,
)
from wtforms import validators
from wtforms.validators import Length
2022-03-08 22:58:05 +01:00
from flask_wtf.file import FileField, FileAllowed, FileSize
from flask_wtf import FlaskForm
class EditorForm(FlaskForm):
"""Css editor form class."""
cssname = StringField(
"fill in a name for your css style:",
validators=[validators.InputRequired(), Length(5, 200)],
)
2022-03-08 22:58:05 +01:00
cssfile = FileField(
"(Optional) upload your own css file:",
validators=[
FileAllowed(["css"], "css files only!"),
FileSize(
max_size=10485760,
message="Zipfile size must be smaller than 100MB",
),
],
)
css = TextAreaField()
2022-03-08 22:58:05 +01:00
public = BooleanField("Make your CSS public so others can use it")
submit = SubmitField("Save")