You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
926 B
36 lines
926 B
3 years ago
|
"""Form to save your CSS editor work."""
|
||
|
|
||
|
from flask_wtf import FlaskForm
|
||
7 months ago
|
from flask_wtf.file import FileAllowed, FileField, FileSize
|
||
7 months ago
|
from wtforms import (
|
||
6 months ago
|
BooleanField,
|
||
|
StringField,
|
||
|
SubmitField,
|
||
|
TextAreaField,
|
||
|
validators,
|
||
7 months ago
|
)
|
||
7 months ago
|
from wtforms.validators import Length
|
||
3 years ago
|
|
||
|
|
||
|
class EditorForm(FlaskForm):
|
||
6 months ago
|
"""Css editor form class."""
|
||
3 years ago
|
|
||
6 months ago
|
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")
|
||
3 years ago
|
|
||
6 months ago
|
submit = SubmitField("Save")
|