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