aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/grumpy.py')
-rw-r--r--frontend/grumpy.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/frontend/grumpy.py b/frontend/grumpy.py
index ea18a98..0644fca 100644
--- a/frontend/grumpy.py
+++ b/frontend/grumpy.py
@@ -1,10 +1,20 @@
from flask import render_template, request
from flask_classy import FlaskView
from sqlalchemy.sql import collate
+from flask_wtf import FlaskForm
+from wtforms import SelectMultipleField, widgets
+
from backend.lib import models
+class MultiCheckboxField(SelectMultipleField):
+ widget = widgets.ListWidget(prefix_label=False)
+ option_widget = widgets.CheckboxInput()
+
+class FollowSetupForm(FlaskForm):
+ maintainers = MultiCheckboxField('Followed maintainers', coerce=int)
+
class GrumpyView(FlaskView):
route_base='/'
@@ -14,4 +24,14 @@ class GrumpyView(FlaskView):
def setup(self):
maintainers = models.Maintainer.query.order_by(collate(models.Maintainer.email, 'NOCASE')).all()
- return render_template("setup.html", maintainers=maintainers)
+ form = FollowSetupForm()
+ choices = []
+ form_mapping = {}
+ for maintainer in maintainers:
+ choices.append((maintainer.id, maintainer.email))
+ form_mapping[maintainer.id] = maintainer
+
+ form.maintainers.choices = choices
+ form.process()
+
+ return render_template("setup.html", mapping=form_mapping, form=form)