diff --git a/verse/forms/editorform.py b/verse/forms/editorform.py index baf5d64..7c3dc8b 100644 --- a/verse/forms/editorform.py +++ b/verse/forms/editorform.py @@ -2,11 +2,13 @@ from wtforms import ( StringField, TextAreaField, + BooleanField, SubmitField, ) from wtforms import validators from wtforms.validators import Length +from flask_wtf.file import FileField, FileAllowed, FileSize from flask_wtf import FlaskForm @@ -17,5 +19,17 @@ class EditorForm(FlaskForm): "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="Zipfile size must be smaller than 100MB", + ), + ], + ) css = TextAreaField() + public = BooleanField("Make your CSS public so others can use it") + submit = SubmitField("Save") diff --git a/verse/start.py b/verse/start.py index 18ed71c..c7133ee 100644 --- a/verse/start.py +++ b/verse/start.py @@ -72,20 +72,18 @@ def index(): distribusies = {} for distribusi in distribusis: user = User.query.filter_by(id=distribusi.userid).first() - #distribusies[distribusi.distribusiname] = user.email - distribusies[user.email] = distribusi singledistribusi = { - "name": distribusi.distribusiname, + "useremail": user.email, "term": distribusi.term, "course": distribusi.course, "year": distribusi.year, "tags": distribusi.tags.split(','), } - distribusies[user.email] = singledistribusi + distribusies[distribusi.distribusiname] = singledistribusi years = uploadform.academicyear.choices terms = uploadform.term.choices courses = uploadform.course.choices - print(type(courses[0])) + template = render_template( "index.html", distribusies=distribusies, diff --git a/verse/templates/editor.html b/verse/templates/editor.html index c41da2d..0f31170 100644 --- a/verse/templates/editor.html +++ b/verse/templates/editor.html @@ -27,6 +27,20 @@