|
|
@ -4,6 +4,7 @@ from wtforms import ( |
|
|
|
SelectField, |
|
|
|
StringField, |
|
|
|
SubmitField, |
|
|
|
TextAreaField, |
|
|
|
validators, |
|
|
|
) |
|
|
|
from wtforms.validators import ( |
|
|
@ -11,6 +12,7 @@ from wtforms.validators import ( |
|
|
|
Length, |
|
|
|
ValidationError, |
|
|
|
) |
|
|
|
from wtforms.widgets import TextArea |
|
|
|
|
|
|
|
from app import settings |
|
|
|
|
|
|
@ -48,6 +50,24 @@ class UploadForm(FlaskForm): |
|
|
|
distribusiname, |
|
|
|
], |
|
|
|
) |
|
|
|
description = StringField( |
|
|
|
"Description of this distribusi:", |
|
|
|
validators=[ |
|
|
|
Length(10, 4096), |
|
|
|
], |
|
|
|
widget=TextArea(), |
|
|
|
) |
|
|
|
mdfile = FileField( |
|
|
|
"Alternatively upload a markdown file with a description:", |
|
|
|
validators=[ |
|
|
|
FileAllowed(["md"], "markdown only"), |
|
|
|
FileRequired(), |
|
|
|
FileSize( |
|
|
|
max_size=10485760, |
|
|
|
message="markdown file size should be smaller than 10MB", |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|
year = SelectField( |
|
|
|
"Year:", |
|
|
|
validate_choice=True, |
|
|
@ -77,7 +97,7 @@ class UploadForm(FlaskForm): |
|
|
|
FileRequired(), |
|
|
|
FileSize( |
|
|
|
max_size=1073741824, |
|
|
|
message="Zipfile size must be smaller than 100MB", |
|
|
|
message="Zipfile size must be smaller than 1024MB", |
|
|
|
), |
|
|
|
], |
|
|
|
) |
|
|
|