Skip to content

Instantly share code, notes, and snippets.

@simanacci
Last active January 2, 2018 14:45
Show Gist options
  • Save simanacci/58c88d039fc62cc22a2531c3faca6409 to your computer and use it in GitHub Desktop.
Save simanacci/58c88d039fc62cc22a2531c3faca6409 to your computer and use it in GitHub Desktop.
from flask import Flask, render_template, request
from flask_wtf import FlaskForm
from wtforms import SubmitField, SelectMultipleField, widgets
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
option_widget = widgets.CheckboxInput()
class ExampleForm(FlaskForm):
foo = MultiCheckboxField('label'
coerce=int,
choices=[(1, 'one'), (2, 'two'), (3, 'three')],
validators=[])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment